6 th {{ st.tr["Variant"] }}
9 th {{ st.tr["Cadence"] }}
11 tr(v-for="c in sortedChallenges" @click="$emit('click-challenge',c)")
12 td(data-label="Variant") {{ c.vname }}
13 td(data-label="From") {{ c.from.name || "@nonymous" }}
14 td(data-label="To") {{ c.to }}
15 td(data-label="Cadence") {{ c.timeControl }}
19 import { store } from "@/store";
22 name: "my-challenge-list",
23 props: ["challenges"],
30 sortedChallenges: function() {
31 // Show in order: challenges I sent, challenges I received, other challenges
32 let augmentedChalls = this.challenges.map(c => {
34 if (c.to == this.st.user.name)
36 else if (c.from.id == this.st.user.id || c.from.sid == this.st.user.sid)
38 return Object.assign({}, c, {priority: priority});
40 return augmentedChalls.sort((c1,c2) => { return c2.priority - c1.priority; });