From 44451193f6d1223286fa7a84eae566db2a6e4b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 2 Feb 2023 19:51:26 +0100 Subject: [PATCH] Use consistent method names in admin stats component We had one method called `vote_count_by_heading` and another one called `user_count_by_district`, when here districts refer to headings. --- app/components/admin/stats/budget_balloting_component.html.erb | 2 +- app/components/admin/stats/budget_balloting_component.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/components/admin/stats/budget_balloting_component.html.erb b/app/components/admin/stats/budget_balloting_component.html.erb index c76967f32..1bb7edb24 100644 --- a/app/components/admin/stats/budget_balloting_component.html.erb +++ b/app/components/admin/stats/budget_balloting_component.html.erb @@ -44,7 +44,7 @@ - <% user_count_by_district.each do |heading_name, count| %> + <% user_count_by_heading.each do |heading_name, count| %>
<%= t("admin.stats.budget_balloting.participants_per_district") %>
<%= heading_name %> diff --git a/app/components/admin/stats/budget_balloting_component.rb b/app/components/admin/stats/budget_balloting_component.rb index b08bce488..de1b06a0f 100644 --- a/app/components/admin/stats/budget_balloting_component.rb +++ b/app/components/admin/stats/budget_balloting_component.rb @@ -19,7 +19,7 @@ class Admin::Stats::BudgetBallotingComponent < ApplicationComponent budget.lines.group(:heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort end - def user_count_by_district + def user_count_by_heading User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort end end