From bf2292ba189d2f66e647b78cb93721b9b7fee408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Tue, 19 Mar 2019 13:36:04 +0100 Subject: [PATCH] Rename budget stats "all phase" to "every phase" "All phase" doesn't sound right in English, and we're going to refactor the code related to the phases. --- app/models/budget/stats.rb | 10 +++++----- app/views/budgets/stats/show.html.erb | 2 +- spec/models/budget/stats_spec.rb | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/models/budget/stats.rb b/app/models/budget/stats.rb index 513fc0af4..536c99b12 100644 --- a/app/models/budget/stats.rb +++ b/app/models/budget/stats.rb @@ -51,7 +51,7 @@ class Budget::Stats 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 + groups[:total][:total_participants_every_phase] = groups.collect {|_k, v| v[:total_participants_every_phase]}.sum budget.headings.each do |heading| groups[heading.id].merge!(calculate_heading_stats_with_totals(groups[heading.id], groups[:total], heading.population)) @@ -59,7 +59,7 @@ class Budget::Stats groups[:total][:percentage_participants_support_phase] = groups.collect {|_k, v| v[:percentage_participants_support_phase]}.sum groups[:total][:percentage_participants_vote_phase] = groups.collect {|_k, v| v[:percentage_participants_vote_phase]}.sum - groups[:total][:percentage_participants_all_phase] = groups.collect {|_k, v| v[:percentage_participants_all_phase]}.sum + groups[:total][:percentage_participants_every_phase] = groups.collect {|_k, v| v[:percentage_participants_every_phase]}.sum groups end @@ -101,7 +101,7 @@ class Budget::Stats total_investments_count: heading.investments.count, total_participants_support_phase: voters_by_heading(heading).count, total_participants_vote_phase: balloters_by_heading(heading.id).count, - total_participants_all_phase: voters_and_balloters_by_heading(heading) + total_participants_every_phase: voters_and_balloters_by_heading(heading) } end @@ -111,8 +111,8 @@ class Budget::Stats percentage_district_population_support_phase: population_percent(population, heading_totals[:total_participants_support_phase]), percentage_participants_vote_phase: participants_percent(heading_totals, groups_totals, :total_participants_vote_phase), percentage_district_population_vote_phase: population_percent(population, heading_totals[:total_participants_vote_phase]), - percentage_participants_all_phase: participants_percent(heading_totals, groups_totals, :total_participants_all_phase), - percentage_district_population_all_phase: population_percent(population, heading_totals[:total_participants_all_phase]) + percentage_participants_every_phase: participants_percent(heading_totals, groups_totals, :total_participants_every_phase), + percentage_district_population_every_phase: population_percent(population, heading_totals[:total_participants_every_phase]) } end diff --git a/app/views/budgets/stats/show.html.erb b/app/views/budgets/stats/show.html.erb index f17685f97..b944fe893 100644 --- a/app/views/budgets/stats/show.html.erb +++ b/app/views/budgets/stats/show.html.erb @@ -122,7 +122,7 @@ <%= @stats.headings[heading.id][:total_investments_count] %> - <% ["support", "vote", "all"].each do |phase| %> + <% ["support", "vote", "every"].each do |phase| %> <%= @stats.headings[heading.id]["total_participants_#{phase}_phase".to_sym] %> diff --git a/spec/models/budget/stats_spec.rb b/spec/models/budget/stats_spec.rb index 71630e21e..3e293a410 100644 --- a/spec/models/budget/stats_spec.rb +++ b/spec/models/budget/stats_spec.rb @@ -204,13 +204,13 @@ describe Budget::Stats do expect(heading_stats[:total_investments_count]).to be 2 expect(heading_stats[:total_participants_support_phase]).to be 2 expect(heading_stats[:total_participants_vote_phase]).to be 1 - expect(heading_stats[:total_participants_all_phase]).to be 3 + expect(heading_stats[:total_participants_every_phase]).to be 3 expect(heading_stats[:percentage_participants_support_phase]).to be 100.0 expect(heading_stats[:percentage_district_population_support_phase]).to be 0.162 expect(heading_stats[:percentage_participants_vote_phase]).to be 100.0 expect(heading_stats[:percentage_district_population_vote_phase]).to be 0.081 - expect(heading_stats[:percentage_participants_all_phase]).to be 100.0 - expect(heading_stats[:percentage_district_population_all_phase]).to be 0.243 + expect(heading_stats[:percentage_participants_every_phase]).to be 100.0 + expect(heading_stats[:percentage_district_population_every_phase]).to be 0.243 end end end