Adjust sort direction to match master branch
This commit is contained in:
parent
26a467e146
commit
1f639506d7
1 changed files with 11 additions and 13 deletions
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue