issue_query_group_by.patch

Tom Scheler, 2017-04-08 16:17

Download (1.97 KB)

View differences:

app/models/issue_query.rb
24 24
    QueryColumn.new(:id, :sortable => "#{Issue.table_name}.id", :default_order => 'desc', :caption => '#', :frozen => true),
25 25
    QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
26 26
    QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true),
27
    QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue),
27
    QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue, :groupable => true),
28 28
    QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true),
29 29
    QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true),
30 30
    QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"),
app/models/query.rb
774 774
  def group_by_sort_order
775 775
    if column = group_by_column
776 776
      order = (sort_criteria.order_for(column.name) || column.default_order || 'asc').try(:upcase)
777
      Array(column.sortable).map {|s| "#{s} #{order}"}
777
      Array(column.sortable).map {|s| (s.split.size > 1) ? s : "#{s} #{order}"}
778 778
    end
779 779
  end
780 780

  
781
-