summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/query.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index a9d24ad30..cc84b01ed 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -543,11 +543,9 @@ class Query < ActiveRecord::Base
# Returns the SQL sort order that should be prepended for grouping
def group_by_sort_order
- if grouped? && (column = group_by_column)
+ if column = group_by_column
order = (sort_criteria_order_for(column.name) || column.default_order).try(:upcase)
- column.sortable.is_a?(Array) ?
- column.sortable.collect {|s| "#{s} #{order}"} :
- "#{column.sortable} #{order}"
+ Array(column.sortable).map {|s| "#{s} #{order}"}
end
end