Sort Order for tasks #110
|
@ -320,9 +320,11 @@ func sortTasks(tasks []*Task, by []*sortParam) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, param := range by {
|
for _, param := range by {
|
||||||
|
|||||||
comparator, ok := comparators[param.sortBy]
|
var comparator TaskComparator
|
||||||
|
var ok bool
|
||||||
|
comparator, ok = comparators[param.sortBy]
|
||||||
if !ok {
|
if !ok {
|
||||||
// TODO: Handle case that a suitable comparator has not been found
|
panic("No suitable comparator for sortBy found! Param was " + param.sortBy)
|
||||||
konrad
commented
@shilch Why are you duplicating the comparator here? @shilch Why are you duplicating the comparator here?
shilch
commented
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).
|
// This is a descending sort, so we need to negate the comparator (i.e. switch the inputs).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user
IMHO we could panic here, this is only an internal api. User validation input happens way earlier.