<%= back_link_to new_officing_poll_result_path(@poll) %>

<%= @poll.name %> - <%= t("officing.results.index.results") %>

<% if @partial_results.present? %>

<%= @booth_assignment.booth.name %> - <%= l @partial_results.first.date, format: :long %>

<%= t("officing.results.index.table_whites") %> <%= t("officing.results.index.table_nulls") %> <%= t("officing.results.index.table_total") %>
<%= @recounts.sum(:white_amount) %> <%= @recounts.sum(:null_amount) %> <%= @recounts.sum(:total_amount) %>
<% by_question = @partial_results.group_by(&:question_id) %> <% @poll.questions.each do |question| %>

<%= question.title %>

<% question.question_answers.each_with_index do |answer, i| %> <% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %> <% end %>
<%= t("officing.results.index.table_answer") %> <%= t("officing.results.index.table_votes") %>
<%= answer.title %> <%= by_answer[answer.title].present? ? by_answer[answer.title].first.amount : 0 %>
<% end %>
<% else %>
<%= t("officing.results.index.no_results") %>
<% end %>