Merge pull request #3603 from consul/admin_stats_before_voting_phase

Avoid error when accessing final voting stats before the balloting phase
This commit is contained in:
Julian Nicolas Herrero
2019-06-11 14:34:42 +02:00
committed by GitHub
6 changed files with 31 additions and 2 deletions

View File

@@ -74,6 +74,9 @@ class Admin::StatsController < Admin::BaseController
def budget_balloting
@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