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.cadence }}
19 import { store } from "@/store";
21 name: "my-challenge-list",
22 props: ["challenges"],
29 sortedChallenges: function() {
30 // Show in order: challenges I sent, challenges I received, other challenges
31 let augmentedChalls = this.challenges.map(c => {
33 if (c.to == this.st.user.name)
35 else if (c.from.id == this.st.user.id || c.from.sid == this.st.user.sid)
37 return Object.assign({}, c, {priority: priority});
39 return augmentedChalls.sort((c1,c2) => { return c2.priority - c1.priority; });