Avoid error when accessing final votes stats before balloting phase
When accessing the URL `/admin/stats/budget_balloting?budget_id=X' for a budget in a phase prior to the balloting phase, the following error was raised due to the stats where not calculated yet. Instead, we'll now show a flash message. NoMethodError: undefined method `[]' for nil:NilClass ./app/controllers/admin/stats_controller.rb:82
This commit is contained in:
@@ -66,6 +66,8 @@ module Abilities
|
||||
can [:valuate, :comment_valuation], Budget::Investment
|
||||
can :create, Budget::ValuatorAssignment
|
||||
|
||||
can(:read_admin_stats, Budget) { |budget| budget.balloting_or_later? }
|
||||
|
||||
can [:search, :edit, :update, :create, :index, :destroy], Banner
|
||||
|
||||
can [:index, :create, :edit, :update, :destroy], Geozone
|
||||
|
||||
Reference in New Issue
Block a user