Sort Order for tasks #110

Merged
konrad merged 62 commits from feature/sort-order into master 2019-12-07 14:30:52 +00:00
1 changed files with 4 additions and 1 deletions
Showing only changes of commit 143e7f7f96 - Show all commits

View File

@ -199,7 +199,10 @@ func sortTasks(tasks []*Task, by []*sortParam) {
// Always sort at least by id asc so we have a consistent order of items every time
// If we would not do this, we would get a different order for items with the same content every time
// the slice is sorted. To circumvent this, we always order at least by ID.
by = append(by, &sortParam{sortBy: taskPropertyID, orderBy: orderAscending})
if len(by) == 0 ||
(len(by) > 0 && by[len(by)-1].sortBy != taskPropertyID) { // Don't sort by ID last if the id parameter is already passed as the last parameter.
by = append(by, &sortParam{sortBy: taskPropertyID, orderBy: orderAscending})
}
comparators := make([]taskComparator, 0, len(by))
for _, param := range by {