adds automatic recount to admin poll and paginates recounts
This commit is contained in:
@@ -14,32 +14,45 @@
|
||||
<th><%= t("admin.recounts.index.table_booth_name") %></th>
|
||||
<th class="text-center"><%= t("admin.recounts.index.table_recounts") %></th>
|
||||
<th class="text-center"><%= t("admin.recounts.index.table_final_recount") %></th>
|
||||
<th class="text-center"><%= t("admin.recounts.index.table_system_count") %></th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @booth_assignments.each do |booth_assignment| %>
|
||||
<% recount = booth_assignment_sum_recounts(booth_assignment) %>
|
||||
<% final_recount = booth_assignment_sum_final_recounts(booth_assignment) %>
|
||||
<% system_count = booth_assignment.voters.size %>
|
||||
<tr id="<%= dom_id(booth_assignment) %>_recounts" class="booth_recounts">
|
||||
<td>
|
||||
<strong>
|
||||
<%= link_to booth_assignment.booth.name, admin_poll_booth_assignment_path(@poll, booth_assignment, anchor: 'tab-recounts') %>
|
||||
</strong>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<% if booth_assignment.recounts.any? %>
|
||||
<%= booth_assignment.recounts.to_a.sum(&:count) %>
|
||||
<td class="text-center <%= 'count-error' if recount.to_i != system_count %>">
|
||||
<% if recount.present? %>
|
||||
<%= recount %>
|
||||
<% else %>
|
||||
<span>-</span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-center <%= 'count-error' if final_recount.to_i != system_count %>">
|
||||
<% if final_recount.present? %>
|
||||
<strong><%= final_recount %></strong>
|
||||
<% else %>
|
||||
<span>-</span>
|
||||
<% end %>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<% if booth_assignment.final_recounts.any? %>
|
||||
<strong><%= booth_assignment.final_recounts.to_a.sum(&:count) %></strong>
|
||||
<% if system_count.present? %>
|
||||
<strong><%= system_count %></strong>
|
||||
<% else %>
|
||||
<span>-</span>
|
||||
<span>0</span>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= paginate @booth_assignments %>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user