summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-09 20:01:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2017-03-09 20:01:01 +0000
commitb714c714024796d3cd3bd215b07b4d8798a35406 (patch)
treecf80ecad1125c44db2b8510ce93f819aeaf394da /app/helpers
parent364d1aa72746424b87e1a17823612096db7c3ae3 (diff)
downloadredmine-b714c714024796d3cd3bd215b07b4d8798a35406.tar.gz
redmine-b714c714024796d3cd3bd215b07b4d8798a35406.zip
Get the count by group from the query directly.
git-svn-id: http://svn.redmine.org/redmine/trunk@16387 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/issues_helper.rb4
-rw-r--r--app/helpers/queries_helper.rb5
2 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index f95338284..703607999 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -32,9 +32,9 @@ module IssuesHelper
end
end
- def grouped_issue_list(issues, query, issue_count_by_group, &block)
+ def grouped_issue_list(issues, query, &block)
ancestors = []
- grouped_query_results(issues, query, issue_count_by_group) do |issue, group_name, group_count, group_totals|
+ grouped_query_results(issues, query) do |issue, group_name, group_count, group_totals|
while (ancestors.any? && !issue.is_descendant_of?(ancestors.last))
ancestors.pop
end
diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb
index c356ca0d4..197bbb998 100644
--- a/app/helpers/queries_helper.rb
+++ b/app/helpers/queries_helper.rb
@@ -115,7 +115,8 @@ module QueriesHelper
render :partial => 'queries/columns', :locals => {:query => query, :tag_name => tag_name}
end
- def grouped_query_results(items, query, item_count_by_group, &block)
+ def grouped_query_results(items, query, &block)
+ result_count_by_group = query.result_count_by_group
previous_group, first = false, true
totals_by_group = query.totalable_columns.inject({}) do |h, column|
h[column] = query.total_by_group_for(column)
@@ -132,7 +133,7 @@ module QueriesHelper
group_name = format_object(group)
end
group_name ||= ""
- group_count = item_count_by_group ? item_count_by_group[group] : nil
+ group_count = result_count_by_group ? result_count_by_group[group] : nil
group_totals = totals_by_group.map {|column, t| total_tag(column, t[group] || 0)}.join(" ").html_safe
end
end