diff --git a/app/controllers/admin/poll/officer_assignments_controller.rb b/app/controllers/admin/poll/officer_assignments_controller.rb
index 3a704b21a..e52108645 100644
--- a/app/controllers/admin/poll/officer_assignments_controller.rb
+++ b/app/controllers/admin/poll/officer_assignments_controller.rb
@@ -8,7 +8,7 @@ class Admin::Poll::OfficerAssignmentsController < Admin::BaseController
@officer = ::Poll::Officer.includes(:user).find(officer_assignment_params[:officer])
@officer_assignments = ::Poll::OfficerAssignment.
joins(:booth_assignment).
- includes(booth_assignment: :booth).
+ includes(:recount, :final_recounts, booth_assignment: :booth).
where("officer_id = ? AND poll_booth_assignments.poll_id = ?", @officer.id, @poll.id).
order(:date)
end
diff --git a/app/views/admin/poll/officer_assignments/index.html.erb b/app/views/admin/poll/officer_assignments/index.html.erb
index 8bac58295..1b83ca752 100644
--- a/app/views/admin/poll/officer_assignments/index.html.erb
+++ b/app/views/admin/poll/officer_assignments/index.html.erb
@@ -65,5 +65,59 @@
<% end %>
+<% voting_days_officer_assignments = @officer_assignments.select{|oa| oa.final == false} %>
+<% if voting_days_officer_assignments.any? %>
+
<%= t("admin.poll_officer_assignments.index.recounts") %>
+
+
+
+ | <%= t("admin.poll_officer_assignments.index.date") %> |
+ <%= t("admin.poll_officer_assignments.index.booth") %> |
+ <%= t("admin.poll_officer_assignments.index.recount") %> |
+
+
+
+ <% voting_days_officer_assignments.each do |officer_assignment| %>
+
+ | <%= l(officer_assignment.date.to_date) %> |
+ <%= booth_name_with_location(officer_assignment.booth_assignment.booth) %> |
+ <% if officer_assignment.recount.present? %>
+ <%= officer_assignment.recount.count %> |
+ <% else %>
+ - |
+ <% end %>
+
+ <% end %>
+
+
+<% end %>
+
+<% final_officer_assignments = @officer_assignments.select{|oa| oa.final == true} %>
+<% if final_officer_assignments.any? %>
+ <%= t("admin.poll_officer_assignments.index.final_recounts") %>
+
+
+
+ | <%= t("admin.poll_officer_assignments.index.date") %> |
+ <%= t("admin.poll_officer_assignments.index.booth") %> |
+ <%= t("admin.poll_officer_assignments.index.final_recount") %> |
+
+
+
+ <% final_officer_assignments.each do |officer_assignment| %>
+
+ | <%= l(officer_assignment.date.to_date) %> |
+ <%= booth_name_with_location(officer_assignment.booth_assignment.booth) %> |
+ <% if officer_assignment.final_recounts.any? %>
+ <%= officer_assignment.final_recounts.to_a.sum(&:count) %> |
+ <% else %>
+ - |
+ <% end %>
+
+ <% end %>
+
+
+<% end %>
+
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml
index b5ac39456..f0d937e29 100755
--- a/config/locales/admin.en.yml
+++ b/config/locales/admin.en.yml
@@ -277,6 +277,10 @@ en:
remove_assignment: "Remove"
assignments: "Officing shifts in this poll"
no_assignments: "This user has no officing shifts in this poll."
+ recounts: "Daily recounts"
+ recount: "Recount"
+ final_recounts: "Final recounts"
+ final_recount: "Final recount"
poll_booth_assignments:
show:
location: "Location"
diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml
index d1b485231..b9d764ff9 100644
--- a/config/locales/admin.es.yml
+++ b/config/locales/admin.es.yml
@@ -277,6 +277,10 @@ es:
remove_assignment: "Eliminar turno"
assignments: "Turnos como presidente de mesa en esta votación"
no_assignments: "No tiene turnos como presidente de mesa en esta votación."
+ recounts: "Recuentos diarios"
+ recount: "Recuento"
+ final_recounts: "Recuentos finales"
+ final_recount: "Recuento total"
poll_booth_assignments:
show:
location: "Ubicación"
diff --git a/spec/features/admin/poll/officer_assignments_spec.rb b/spec/features/admin/poll/officer_assignments_spec.rb
index 53b174b9a..1b62fab30 100644
--- a/spec/features/admin/poll/officer_assignments_spec.rb
+++ b/spec/features/admin/poll/officer_assignments_spec.rb
@@ -48,7 +48,7 @@ feature 'Admin officer assignments in poll' do
expect(page).to have_content officer.email
end
- scenario 'remove booth from poll' do
+ scenario 'Remove officer assignment from poll' do
officer_assignment = create(:poll_officer_assignment)
poll = officer_assignment.booth_assignment.poll
booth = officer_assignment.booth_assignment.booth
@@ -65,4 +65,33 @@ feature 'Admin officer assignments in poll' do
expect(page).to have_content 'Officing shift removed'
expect(page).to have_content 'This user has no officing shifts in this poll'
end
+
+ scenario 'Index view shows recounts info for officer' do
+ booth_assignment = create(:poll_booth_assignment)
+ poll = booth_assignment.poll
+ officer = create(:poll_officer)
+ officer_assignment = create(:poll_officer_assignment,
+ booth_assignment: booth_assignment,
+ officer: officer,
+ date: poll.starts_at)
+ final_officer_assignment = create(:poll_officer_assignment, :final,
+ booth_assignment: booth_assignment,
+ officer: officer,
+ date: poll.ends_at + 1.day)
+ recount = create(:poll_recount,
+ booth_assignment: booth_assignment,
+ officer_assignment: officer_assignment,
+ date: officer_assignment.date,
+ count: 77)
+ final_recount = create(:poll_final_recount,
+ booth_assignment: booth_assignment,
+ officer_assignment: final_officer_assignment,
+ date: poll.ends_at,
+ count: 9876)
+
+ visit admin_officer_assignments_path(poll: poll, officer: officer)
+
+ within('#recount_list') { expect(page).to have_content('77') }
+ within('#final_recount_list') { expect(page).to have_content('9876') }
+ end
end
\ No newline at end of file