adds link to results for each final recount in officing

This commit is contained in:
Juanjo Bazán
2017-02-01 16:22:04 +01:00
parent 60adc22830
commit 1f985ef8f3
4 changed files with 27 additions and 1 deletions

View File

@@ -53,6 +53,7 @@
<th><%= t("officing.final_recounts.new.booth") %></th>
<th><%= t("officing.final_recounts.new.count") %></th>
<th><%= t("officing.final_recounts.new.system_count") %></th>
<th>&nbsp;</th>
</thead>
<tbody>
<% @final_recounts.each do |final_recount| %>
@@ -69,6 +70,9 @@
<td>
<strong><%= system_recount_to_compare_with_final_recount final_recount %></strong>
</td>
<td>
<%= 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) )%>
</td>
</tr>
<% end %>
</tbody>

View File

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

View File

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

View File

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