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.
This commit is contained in:
Javi Martín
2023-02-02 19:51:26 +01:00
parent 76b08398cf
commit 44451193f6
2 changed files with 2 additions and 2 deletions

View File

@@ -44,7 +44,7 @@
<table class="investment-projects-summary">
<th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th>
<% user_count_by_district.each do |heading_name, count| %>
<% user_count_by_heading.each do |heading_name, count| %>
<tr id="user_count_<%= heading_name.parameterize %>">
<td class="name">
<%= heading_name %>

View File

@@ -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