Extract component for balloting budget admin stats
We're also moving the tests, but we're keeping one system test in order to test the controller and the navigation to get to this page. Note we're slightly changing the order of the methods in the component; the order of the instance variables was `user_`, `vote_`, `vote_`, `user_`, which was hard to follow.
This commit is contained in:
@@ -75,14 +75,6 @@ class Admin::StatsController < Admin::BaseController
|
||||
@budget = Budget.find(params[:budget_id])
|
||||
|
||||
authorize! :read_admin_stats, @budget, message: t("admin.stats.budgets.no_data_before_balloting_phase")
|
||||
|
||||
@user_count = @budget.ballots.select { |ballot| ballot.lines.any? }.count
|
||||
|
||||
@vote_count = @budget.lines.count
|
||||
|
||||
@vote_count_by_heading = @budget.lines.group(:heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||
|
||||
@user_count_by_district = User.where.not(balloted_heading_id: nil).group(:balloted_heading_id).count.map { |k, v| [Budget::Heading.find(k).name, v] }.sort
|
||||
end
|
||||
|
||||
def polls
|
||||
|
||||
Reference in New Issue
Block a user