refactors recounts into partial
This commit is contained in:
14
app/views/admin/poll/results/_recount.html.erb
Normal file
14
app/views/admin/poll/results/_recount.html.erb
Normal file
@@ -0,0 +1,14 @@
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<th><%= t("admin.results.result.table_whites") %></th>
|
||||
<th><%= t("admin.results.result.table_nulls") %></th>
|
||||
<th><%= t("admin.results.result.table_total") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="white_results"><%= resource.recounts.sum(:white_amount) %></td>
|
||||
<td id="null_results"><%= resource.recounts.sum(:null_amount) %></td>
|
||||
<td id="total_results"><%= resource.recounts.sum(:total_amount) %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -1,19 +1,3 @@
|
||||
<table class="margin">
|
||||
<thead>
|
||||
<th><%= t("admin.results.result.table_whites") %></th>
|
||||
<th><%= t("admin.results.result.table_nulls") %></th>
|
||||
<th><%= t("admin.results.result.table_total") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td id="white_results"><%= @poll.recounts.sum(:white_amount) %></td>
|
||||
<td id="null_results"><%= @poll.recounts.sum(:null_amount) %></td>
|
||||
<td id="total_results"><%= @poll.recounts.sum(:total_amount) %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<% by_question = @partial_results.group_by(&:question_id) %>
|
||||
<% @poll.questions.each do |question| %>
|
||||
<h3><%= question.title %></h3>
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
<%= t("admin.results.index.no_results") %>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render "recount", resource: @poll %>
|
||||
<%= render "result" %>
|
||||
<%= render "results_by_booth" %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user