Remove Poll Recount model and all usages

This commit is contained in:
Bertocq
2017-07-19 19:47:31 +02:00
parent d98425f45b
commit 361e0efe00
19 changed files with 47 additions and 264 deletions

View File

@@ -44,44 +44,30 @@
</div>
<div class="tabs-panel" id="tab-recounts">
<% if @booth_assignment.recounts.empty? %>
<div class="callout primary margin-top">
<%= t("admin.poll_booth_assignments.show.no_recounts") %>
</div>
<% else %>
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
<table id="recounts_list">
<thead>
<tr>
<th><%= t("admin.poll_booth_assignments.show.date") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_officer") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_final") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_system") %></th>
</tr>
</thead>
<tbody>
<% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %>
<% recount = recount_for_date(@booth_assignment.recounts, voting_date) %>
<% final_recount = final_recount_for_date(@booth_assignment.final_recounts, voting_date) %>
<% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %>
<tr id="recounting_<%= voting_date.strftime('%Y%m%d') %>">
<td><%= l voting_date %></td>
<% if recount.present? %>
<td class="text-center <%= 'count-error' if recount.count != system_count %>" title="<%= recount.officer_assignment.officer.name %>"><%= recount.count %></td>
<% else %>
<td class="text-center" title=""> - </td>
<% end %>
<% if final_recount.present? %>
<td class="text-center <%= 'count-error' if final_recount.count != system_count %>" title="<%= final_recount.officer_assignment.officer.name %>"><%= final_recount.count %></td>
<% else %>
<td class="text-center" title=""> - </td>
<% end %>
<td class="text-center"><%= system_count %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
<table id="recounts_list">
<thead>
<tr>
<th><%= t("admin.poll_booth_assignments.show.date") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_final") %></th>
<th class="text-center"><%= t("admin.poll_booth_assignments.show.count_by_system") %></th>
</tr>
</thead>
<tbody>
<% (@poll.starts_at.to_date..@poll.ends_at.to_date).each do |voting_date| %>
<% final_recount = final_recount_for_date(@booth_assignment.final_recounts, voting_date) %>
<% system_count = @voters_by_date[voting_date].present? ? @voters_by_date[voting_date].size : 0 %>
<tr id="recounting_<%= voting_date.strftime('%Y%m%d') %>">
<td><%= l voting_date %></td>
<% if final_recount.present? %>
<td class="text-center <%= 'count-error' if final_recount.count != system_count %>" title="<%= final_recount.officer_assignment.officer.name %>"><%= final_recount.count %></td>
<% else %>
<td class="text-center" title=""> - </td>
<% end %>
<td class="text-center"><%= system_count %></td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>

View File

@@ -65,35 +65,6 @@
</table>
<% end %>
<% voting_days_officer_assignments = @officer_assignments.select{|oa| oa.final == false} %>
<% if voting_days_officer_assignments.any? %>
<h3><%= t("admin.poll_officer_assignments.by_officer.recounts") %></h3>
<table id="recount_list" class="fixed">
<thead>
<tr>
<th><%= t("admin.poll_officer_assignments.by_officer.date") %></th>
<th><%= t("admin.poll_officer_assignments.by_officer.booth") %></th>
<th class="text-right"><%= t("admin.poll_officer_assignments.by_officer.recount") %></th>
</tr>
</thead>
<tbody>
<% voting_days_officer_assignments.each do |officer_assignment| %>
<tr id="recount_<%= officer_assignment.date.to_date.strftime('%Y%m%d') %>">
<td><%= l(officer_assignment.date.to_date) %></td>
<td><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %></td>
<td class="text-right">
<% if officer_assignment.recount.present? %>
<%= officer_assignment.recount.count %>
<% else %>
<span>-</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% end %>
<% final_officer_assignments = @officer_assignments.select{|oa| oa.final == true} %>
<% if final_officer_assignments.any? %>
<h3><%= t("admin.poll_officer_assignments.by_officer.final_recounts") %></h3>

View File

@@ -17,7 +17,6 @@
</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">