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:
@@ -44,7 +44,7 @@
|
|||||||
<table class="investment-projects-summary">
|
<table class="investment-projects-summary">
|
||||||
<th colspan="2"><%= t("admin.stats.budget_balloting.participants_per_district") %></th>
|
<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 %>">
|
<tr id="user_count_<%= heading_name.parameterize %>">
|
||||||
<td class="name">
|
<td class="name">
|
||||||
<%= heading_name %>
|
<%= heading_name %>
|
||||||
|
|||||||
@@ -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
|
budget.lines.group(:heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||||
end
|
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
|
User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user