Skip to content
Snippets Groups Projects
Commit 9bc2bf9e authored by Pierre-Jean CHANCELLIER's avatar Pierre-Jean CHANCELLIER
Browse files

reapre sorting in MemberList

parent 77bd1bc0
No related branches found
No related tags found
No related merge requests found
...@@ -148,7 +148,7 @@ export default { ...@@ -148,7 +148,7 @@ export default {
if (this.certif) return member.received_certifications.limit if (this.certif) return member.received_certifications.limit
return Math.min(member.limitDate, member.received_certifications.limit) return Math.min(member.limitDate, member.received_certifications.limit)
}, },
sort(a, b, order) { getOrder(a, b, order) {
if (a < b) return -1 * order if (a < b) return -1 * order
if (a > b) return 1 * order if (a > b) return 1 * order
return 0 return 0
...@@ -157,23 +157,26 @@ export default { ...@@ -157,23 +157,26 @@ export default {
computed: { computed: {
membersSorted() { membersSorted() {
return this.members return this.members
.slice()
.sort((a, b) => { .sort((a, b) => {
let modifier = this.currentSortDir === "desc" ? -1 : 1 let modifier = this.currentSortDir === "desc" ? -1 : 1
if (this.currentSort == "uid") { if (this.currentSort == "uid") {
this.sort(a["uid"].toLowerCase(), b["uid"].toLowerCase(), modifier) return this.getOrder(
a["uid"].toLowerCase(),
b["uid"].toLowerCase(),
modifier
)
} else if (this.currentSort == "pubkey") { } else if (this.currentSort == "pubkey") {
this.sort( return this.getOrder(
a["pubkey"].toLowerCase(), a["pubkey"].toLowerCase(),
b["pubkey"].toLowerCase(), b["pubkey"].toLowerCase(),
modifier modifier
) )
} else if (this.currentSort == "date_sortie") { } else if (this.currentSort == "date_sortie") {
if (this.adhesion) { if (this.adhesion) {
this.sort(a["limitDate"], b["limitDate"], modifier) return this.getOrder(a["limitDate"], b["limitDate"], modifier)
} else if (this.certif) { } else if (this.certif) {
this.sort( return this.getOrder(
a["received_certifications"]["limit"], a["received_certifications"]["limit"],
b["received_certifications"]["limit"], b["received_certifications"]["limit"],
modifier modifier
...@@ -187,7 +190,7 @@ export default { ...@@ -187,7 +190,7 @@ export default {
b["limitDate"], b["limitDate"],
b["received_certifications"]["limit"] b["received_certifications"]["limit"]
) )
this.sort(minA, minB, modifier) return this.getOrder(minA, minB, modifier)
} }
} }
return 0 return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment