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 2 deletions
Showing only changes of commit 7307eca0c3 - Show all commits

View File

@ -320,9 +320,11 @@ func sortTasks(tasks []*Task, by []*sortParam) {
}
for _, param := range by {

IMHO we could panic here, this is only an internal api. User validation input happens way earlier.

IMHO we could panic here, this is only an internal api. User validation input happens way earlier.
comparator, ok := comparators[param.sortBy]
var comparator TaskComparator
var ok bool
comparator, ok = comparators[param.sortBy]
if !ok {
// TODO: Handle case that a suitable comparator has not been found
panic("No suitable comparator for sortBy found! Param was " + param.sortBy)

@shilch Why are you duplicating the comparator here?

@shilch Why are you duplicating the comparator here?

If I didn't you would end in an infinite recursive loop because comparator would call itself.

If I didn't you would end in an infinite recursive loop because comparator would call itself.
}
// This is a descending sort, so we need to negate the comparator (i.e. switch the inputs).