diff --git a/app/models/budget/stats.rb b/app/models/budget/stats.rb index dda71554b..a70c7d754 100644 --- a/app/models/budget/stats.rb +++ b/app/models/budget/stats.rb @@ -134,6 +134,7 @@ class Budget end groups[:total] = Hash.new(0) + groups[:total][:total_investments_count] = groups.collect {|_k, v| v[:total_investments_count]}.sum groups[:total][:total_participants_support_phase] = groups.collect {|_k, v| v[:total_participants_support_phase]}.sum groups[:total][:total_participants_vote_phase] = groups.collect {|_k, v| v[:total_participants_vote_phase]}.sum groups[:total][:total_participants_all_phase] = groups.collect {|_k, v| v[:total_participants_all_phase]}.sum @@ -152,6 +153,7 @@ class Budget def calculate_heading_totals(heading) { + total_investments_count: heading.investments.count, total_participants_support_phase: voters_by_heading(heading).uniq.count, total_participants_vote_phase: balloters_by_heading(heading.id).uniq.count, total_participants_all_phase: voters_and_balloters_by_heading(heading) diff --git a/app/views/budgets/stats/show.html.erb b/app/views/budgets/stats/show.html.erb index ef77d2030..b9b941307 100644 --- a/app/views/budgets/stats/show.html.erb +++ b/app/views/budgets/stats/show.html.erb @@ -167,7 +167,7 @@

<%= t("budgets.stats.by_heading") %>

- +
@@ -197,7 +197,7 @@ <% ["support", "vote", "all"].each do |phase| %> @@ -206,7 +206,7 @@ <%= @stats[:headings][heading.id]["total_participants_#{phase}_phase".to_sym] %> <% end %> + + + + + <% ["support", "vote", "all"].each do |phase| %> + + + + <% end %> +
<%= t("budgets.stats.heading") %> - <%= heading.investments.count %> + <%= @stats[:headings][heading.id][:total_investments_count] %> + class="border-left border-right text-center"> <%= number_to_percentage(@stats[:headings][heading.id]["percentage_participants_#{phase}_phase".to_sym], strip_insignificant_zeros: true, precision: 2) %> @@ -220,6 +220,29 @@ <% end %>
+ <%= t("budgets.stats.total").upcase %> + + <%= @stats[:headings][:total][:total_investments_count] %> + + <%= @stats[:headings][:total]["total_participants_#{phase}_phase".to_sym] %> + + <%= number_to_percentage(@stats[:headings][:total]["percentage_participants_#{phase}_phase".to_sym], + strip_insignificant_zeros: true, + precision: 2) %> + ">