Adjust sort direction to match master branch

This commit is contained in:
Raimund Schlüßler 2018-12-28 11:33:25 +01:00
parent 26a467e146
commit 1f639506d7
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178

View file

@ -120,30 +120,28 @@ function isParentInList(task, tasks) {
* @returns {Array}
*/
function sort(tasks, sortOrder, sortDirection) {
var sortedTasks
switch (sortOrder) {
case 'alphabetically': {
const sortedTasks = sortAlphabetically(tasks)
if (sortDirection) return sortedTasks
return sortedTasks.reverse()
sortedTasks = sortAlphabetically(tasks)
break
}
case 'priority': {
const sortedTasks = tasks.sort((taskA, taskB) => taskA.priority - taskB.priority)
if (sortDirection) return sortedTasks
return sortedTasks.reverse()
sortedTasks = tasks.sort((taskA, taskB) => taskA.priority - taskB.priority)
break
}
case 'due': {
const sortedTasks = sortByDate(tasks, 'due')
if (sortDirection) return sortedTasks
return sortedTasks.reverse()
sortedTasks = sortByDate(tasks, 'due')
break
}
case 'start': {
const sortedTasks = sortByDate(tasks, 'start')
if (sortDirection) return sortedTasks
return sortedTasks.reverse()
sortedTasks = sortByDate(tasks, 'start')
break
}
default:
return tasks
sortedTasks = tasks
}
return sortDirection ? sortedTasks.reverse() : sortedTasks
}
/**