refactors recounts into partial

This commit is contained in:
rgarcia
2017-10-18 22:40:41 +02:00
parent fcbcca3b60
commit 5d3654f92f
3 changed files with 15 additions and 16 deletions

View 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>

View File

@@ -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>

View File

@@ -9,6 +9,7 @@
<%= t("admin.results.index.no_results") %>
</div>
<% else %>
<%= render "recount", resource: @poll %>
<%= render "result" %>
<%= render "results_by_booth" %>
<% end %>