diff options
Diffstat (limited to 'app/finders')
-rw-r--r-- | app/finders/todos_finder.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/finders/todos_finder.rb b/app/finders/todos_finder.rb index 37bad596a16..06b3e8a9502 100644 --- a/app/finders/todos_finder.rb +++ b/app/finders/todos_finder.rb @@ -33,7 +33,7 @@ class TodosFinder # the project IDs yielded by the todos query thus far items = by_project(items) - items.reorder(id: :desc) + sort(items) end private @@ -106,6 +106,10 @@ class TodosFinder params[:type] end + def sort(items) + params[:sort] ? items.sort(params[:sort]) : items.reorder(id: :desc) + end + def by_action(items) if action? items = items.where(action: to_action_id) |