app/views/admin/poll/results/_result.html.erb
<% by_question = @partial_results.group_by(&:question_id) %>
<% @poll.questions.each do |question| %>
<h3><%= question.title %></h3>
<table class="margin">
<thead>
<tr>
<th><%= t("admin.results.result.table_answer") %></th>
<th class="text-center"><%= t("admin.results.result.table_votes") %></th>
</tr>
</thead>
<tbody>
<% question.question_options.each_with_index do |option, i| %>
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
<tr id="question_<%= question.id %>_<%= i %>_result">
<td><%= option.title %></td>
<td class="text-center"><%= by_answer[option.title].present? ? by_answer[option.title].sum(&:amount) : 0 %></td>
</tr>
<% end %>
</tbody>
</table>
<% end %>