From ae971b23bc3a6cd8565250d1b3a7b30b2f168a33 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Sun, 17 Oct 2021 16:30:34 +0200 Subject: [PATCH] fix: sort order by dueDate, then by id --- src/views/tasks/ShowTasks.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/views/tasks/ShowTasks.vue b/src/views/tasks/ShowTasks.vue index 112dc9ab..f9f1a9d3 100644 --- a/src/views/tasks/ShowTasks.vue +++ b/src/views/tasks/ShowTasks.vue @@ -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