Fix sort order when marking a task as done from the overview
continuous-integration/drone/push Build was killed Details

This commit is contained in:
kolaente 2020-09-28 20:37:06 +02:00
parent 21968ab86d
commit 0440c2cbed
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 18 deletions

View File

@ -168,31 +168,18 @@ export default {
this.error(e, this)
})
},
sortTasks() {
if (this.tasks === null || this.tasks === []) {
return
}
return this.tasks.sort(function (a, b) {
if (a.done < b.done)
return -1
if (a.done > b.done)
return 1
if (a.id > b.id)
return -1
if (a.id < b.id)
return 1
return 0
})
},
updateTasks(updatedTask) {
for (const t in this.tasks) {
if (this.tasks[t].id === updatedTask.id) {
this.$set(this.tasks, t, updatedTask)
// Move the task to the end of the done tasks if it is now done
if (updatedTask.done) {
this.tasks.splice(t, 1)
this.tasks.push(updatedTask)
}
break
}
}
this.sortTasks()
},
},
}