summaryrefslogtreecommitdiff
path: root/app/models/todo.rb
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-17 18:03:06 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:27 -0200
commit928acba4c0ae31626dac621f0f240f18cbad548a (patch)
tree2ef135225db8a550fd735647c002a2067f03270b /app/models/todo.rb
parent8379fbcd47930320bf4dd6a3ac41c6efd427a91a (diff)
downloadgitlab-ce-928acba4c0ae31626dac621f0f240f18cbad548a.tar.gz
Use keyword arguments on Sortable#highest_label_priority
Diffstat (limited to 'app/models/todo.rb')
-rw-r--r--app/models/todo.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/todo.rb b/app/models/todo.rb
index fd90a893d2e..11c072dd000 100644
--- a/app/models/todo.rb
+++ b/app/models/todo.rb
@@ -52,7 +52,13 @@ class Todo < ActiveRecord::Base
# Todos with highest priority first then oldest todos
# Need to order by created_at last because of differences on Mysql and Postgres when joining by type "Merge_request/Issue"
def order_by_labels_priority
- highest_priority = highest_label_priority(["Issue", "MergeRequest"], "todos.project_id", "todos.target_id").to_sql
+ params = {
+ target_type: ['Issue', 'MergeRequest'],
+ target_column: "todos.target_id",
+ project_column: "todos.project_id"
+ }
+
+ highest_priority = highest_label_priority(params).to_sql
select("#{table_name}.*, (#{highest_priority}) AS highest_priority").
order(Gitlab::Database.nulls_last_order('highest_priority', 'ASC')).