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:
@@ -9,8 +9,15 @@
|
||||
<strong><%= budget.name %></strong>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to t("admin.stats.budgets.supporting_phase"), budget_supporting_admin_stats_path(budget_id: budget.id), class: "button hollow" %>
|
||||
<%= link_to t("admin.stats.budgets.balloting_phase"), budget_balloting_admin_stats_path(budget_id: budget.id), class: "button hollow" %>
|
||||
<%= link_to t("admin.stats.budgets.supporting_phase"),
|
||||
budget_supporting_admin_stats_path(budget_id: budget.id),
|
||||
class: "button hollow" %>
|
||||
|
||||
<% if can? :read_admin_stats, budget %>
|
||||
<%= link_to t("admin.stats.budgets.balloting_phase"),
|
||||
budget_balloting_admin_stats_path(budget_id: budget.id),
|
||||
class: "button hollow" %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user