Make the _unix suffix optional when sorting tasks
This commit is contained in:
@ -118,6 +118,20 @@ func (tf *TaskCollection) ReadAll(a web.Auth, search string, page int, perPage i
|
||||
if len(tf.OrderBy) > i {
|
||||
param.orderBy = getSortOrderFromString(tf.OrderBy[i])
|
||||
}
|
||||
|
||||
// Special case for pseudo date fields
|
||||
// FIXME: This is really dirty, to fix this properly the db fields should be renamed
|
||||
switch param.sortBy {
|
||||
case "done_at":
|
||||
param.sortBy = taskPropertyDoneAtUnix
|
||||
case "due_date":
|
||||
param.sortBy = taskPropertyDueDateUnix
|
||||
case "start_date":
|
||||
param.sortBy = taskPropertyStartDateUnix
|
||||
case "end_date":
|
||||
param.sortBy = taskPropertyEndDateUnix
|
||||
}
|
||||
|
||||
// Param validation
|
||||
if err := param.validate(); err != nil {
|
||||
return nil, 0, 0, err
|
||||
|
@ -90,7 +90,7 @@ func getTaskFiltersByCollections(c *TaskCollection) (filters []*taskFilter, err
|
||||
}
|
||||
|
||||
// Special case for pseudo date fields
|
||||
// FIXME: This is really dirty, to fix this the db fields should be renamed
|
||||
// FIXME: This is really dirty, to fix this properly the db fields should be renamed
|
||||
if filter.field+"_unix" == taskPropertyDoneAtUnix ||
|
||||
filter.field+"_unix" == taskPropertyDueDateUnix ||
|
||||
filter.field+"_unix" == taskPropertyStartDateUnix ||
|
||||
|
Reference in New Issue
Block a user