fix: sort order by dueDate, then by id

This commit is contained in:
Dominik Pschenitschni 2021-10-17 16:30:34 +02:00
parent 2de94bc902
commit ae971b23bc
No known key found for this signature in database
GPG key ID: B257AC0149F43A77

View file

@ -207,7 +207,12 @@ export default {
// soonest before the later ones.
// We can't use the api sorting here because that sorts tasks with a due date after
// ones without a due date.
this.tasks = tasks.sort((a, b) => a.dueDate - b.dueDate)
this.tasks = tasks.sort((a, b) => {
const sortByDueDate = b.dueDate - a.dueDate
return sortByDueDate === 0
? b.id - a.id
: sortByDueDate
})
},
// FIXME: this modification should happen in the store