diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-09 20:01:01 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-09 20:01:01 +0000 |
commit | b714c714024796d3cd3bd215b07b4d8798a35406 (patch) | |
tree | cf80ecad1125c44db2b8510ce93f819aeaf394da /app/helpers/queries_helper.rb | |
parent | 364d1aa72746424b87e1a17823612096db7c3ae3 (diff) | |
download | redmine-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/queries_helper.rb')
-rw-r--r-- | app/helpers/queries_helper.rb | 5 |
1 files changed, 3 insertions, 2 deletions
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 |