summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-13 19:17:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-13 19:17:59 +0000
commit71d88e55352a51b20dd5e2a4a44aa695834a36b9 (patch)
tree8d5708333c51b7da7319a5c182350758b00dc535 /app/models/issue_query.rb
parentb91489ce6bb0943cff50946af6e64be65d3ccd80 (diff)
downloadredmine-71d88e55352a51b20dd5e2a4a44aa695834a36b9.tar.gz
redmine-71d88e55352a51b20dd5e2a4a44aa695834a36b9.zip
Get rid of sort_helper when using queries.
git-svn-id: http://svn.redmine.org/redmine/trunk@16390 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index 71fe8d288..9f3bf290d 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -234,6 +234,10 @@ class IssueQuery < Query
Setting.issue_list_default_totals.map(&:to_sym)
end
+ def default_sort_criteria
+ [['id', 'desc']]
+ end
+
def base_scope
Issue.visible.joins(:status, :project).where(statement)
end
@@ -267,7 +271,7 @@ class IssueQuery < Query
# Returns the issues
# Valid options are :order, :offset, :limit, :include, :conditions
def issues(options={})
- order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?)
+ order_option = [group_by_sort_order, (options[:order] || sort_clause)].flatten.reject(&:blank?)
scope = Issue.visible.
joins(:status, :project).
@@ -309,7 +313,7 @@ class IssueQuery < Query
# Returns the issues ids
def issue_ids(options={})
- order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?)
+ order_option = [group_by_sort_order, (options[:order] || sort_clause)].flatten.reject(&:blank?)
Issue.visible.
joins(:status, :project).