From 6060d875398834b6fbd9128261d90619e5da1bdc Mon Sep 17 00:00:00 2001 From: Tom Date: Sat, 8 Apr 2017 16:14:21 +0200 Subject: [PATCH] added grouping by parent task --- app/models/issue_query.rb | 2 +- app/models/query.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb index 6d1298c..582403b 100644 --- a/app/models/issue_query.rb +++ b/app/models/issue_query.rb @@ -24,7 +24,7 @@ class IssueQuery < Query QueryColumn.new(:id, :sortable => "#{Issue.table_name}.id", :default_order => 'desc', :caption => '#', :frozen => true), QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true), QueryColumn.new(:tracker, :sortable => "#{Tracker.table_name}.position", :groupable => true), - QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue), + QueryColumn.new(:parent, :sortable => ["#{Issue.table_name}.root_id", "#{Issue.table_name}.lft ASC"], :default_order => 'desc', :caption => :field_parent_issue, :groupable => true), QueryColumn.new(:status, :sortable => "#{IssueStatus.table_name}.position", :groupable => true), QueryColumn.new(:priority, :sortable => "#{IssuePriority.table_name}.position", :default_order => 'desc', :groupable => true), QueryColumn.new(:subject, :sortable => "#{Issue.table_name}.subject"), diff --git a/app/models/query.rb b/app/models/query.rb index 863bdbc..d03335c 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -774,7 +774,7 @@ class Query < ActiveRecord::Base def group_by_sort_order if column = group_by_column order = (sort_criteria.order_for(column.name) || column.default_order || 'asc').try(:upcase) - Array(column.sortable).map {|s| "#{s} #{order}"} + Array(column.sortable).map {|s| (s.split.size > 1) ? s : "#{s} #{order}"} end end -- 2.1.4