From 1f985ef8f3c45c2e83c6638cf4736220214560ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Wed, 1 Feb 2017 16:22:04 +0100 Subject: [PATCH] adds link to results for each final recount in officing --- .../officing/final_recounts/new.html.erb | 4 ++++ config/locales/officing.en.yml | 1 + config/locales/officing.es.yml | 1 + spec/features/officing/final_recount_spec.rb | 22 ++++++++++++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/views/officing/final_recounts/new.html.erb b/app/views/officing/final_recounts/new.html.erb index ee09a1d38..647bd31b4 100644 --- a/app/views/officing/final_recounts/new.html.erb +++ b/app/views/officing/final_recounts/new.html.erb @@ -53,6 +53,7 @@ <%= t("officing.final_recounts.new.booth") %> <%= t("officing.final_recounts.new.count") %> <%= t("officing.final_recounts.new.system_count") %> +   <% @final_recounts.each do |final_recount| %> @@ -69,6 +70,9 @@ <%= system_recount_to_compare_with_final_recount final_recount %> + + <%= link_to t("officing.final_recounts.new.add_results"), new_officing_poll_result_path(@poll, oa: final_recount.officer_assignment.id, d: l(final_recount.date.to_date) )%> + <% end %> diff --git a/config/locales/officing.en.yml b/config/locales/officing.en.yml index 084ceb4ba..fd1987833 100644 --- a/config/locales/officing.en.yml +++ b/config/locales/officing.en.yml @@ -52,6 +52,7 @@ en: submit: Save final_recount_list: "Your final recounts" system_count: "System recount" + add_results: "Add results" results: flash: create: "Results saved" diff --git a/config/locales/officing.es.yml b/config/locales/officing.es.yml index 56d6f745f..79e8b4f98 100644 --- a/config/locales/officing.es.yml +++ b/config/locales/officing.es.yml @@ -52,6 +52,7 @@ es: submit: "Guardar" final_recount_list: "Tus recuentos finales" system_count: "Recuento del sistema" + add_results: "AƱadir resultados" results: flash: create: "Datos guardados" diff --git a/spec/features/officing/final_recount_spec.rb b/spec/features/officing/final_recount_spec.rb index c9ed2a5c5..75ecbf7ec 100644 --- a/spec/features/officing/final_recount_spec.rb +++ b/spec/features/officing/final_recount_spec.rb @@ -122,6 +122,26 @@ feature 'Officing Final Recount' do expect(page).to have_content('100') expect(page).to have_content('33') end - end + + scenario "Show link to add results for same booth/date" do + final_officer_assignment = create(:poll_officer_assignment, :final, officer: @poll_officer) + poll = final_officer_assignment.booth_assignment.poll + poll.update(ends_at: 1.day.ago) + final_recount = create(:poll_final_recount, + officer_assignment: final_officer_assignment, + booth_assignment: final_officer_assignment.booth_assignment, + date: 7.days.ago, + count: 100) + visit new_officing_poll_final_recount_path(poll) + within("#poll_final_recount_#{final_recount.id}") do + click_link "Add results" + end + + expected_path = new_officing_poll_result_path(poll, oa: final_recount.officer_assignment.id, d: I18n.l(final_recount.date.to_date)) + expect(page).to have_current_path(expected_path) + expect(page).to have_select('officer_assignment_id', selected: final_recount.booth_assignment.booth.name) + expect(page).to have_select('date', selected: I18n.l(final_recount.date.to_date, format: :long)) + end + end \ No newline at end of file