adds index view for poll results in officing
This commit is contained in:
30
app/views/officing/results/index.html.erb
Normal file
30
app/views/officing/results/index.html.erb
Normal file
@@ -0,0 +1,30 @@
|
||||
<%= back_link_to new_officing_poll_result_path(@poll) %>
|
||||
<h2><%= @poll.name %> - <%= t("officing.results.index.results") %></h2>
|
||||
|
||||
<% if @partial_results.present? %>
|
||||
<div class="callout primary">
|
||||
<h3><%= @booth_assignment.booth.name %> - <%= l @partial_results.first.date, format: :long %></h3>
|
||||
</div>
|
||||
|
||||
<% by_question = @partial_results.group_by(&:question_id) %>
|
||||
<% @poll.questions.each do |question| %>
|
||||
<h3><%= question.title %></h3>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<% question.valid_answers.each_with_index do |answer, i| %>
|
||||
<% by_answer = by_question[question.id].present? ? by_question[question.id].group_by(&:answer) : {} %>
|
||||
<tr id="question_<%= question.id %>_<%= i %>_result">
|
||||
<td><%= answer %></td>
|
||||
<td><%= by_answer[answer].present? ? by_answer[answer].first.amount : 0 %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div class="callout primary">
|
||||
<%= t("officing.results.index.no_results") %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -81,13 +81,13 @@
|
||||
<% results_by_booth[booth_assignment].group_by(&:date).keys.each do |date| %>
|
||||
<tr id="results_<%= booth_assignment %>_<%= date.strftime('%Y%m%d') %>">
|
||||
<td>
|
||||
<%= l(date.to_date, format: :long) %>
|
||||
<%= l(date, format: :long) %>
|
||||
</td>
|
||||
<td>
|
||||
<%= results_by_booth[booth_assignment].first.booth_assignment.booth.name %>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
<%= link_to t("officing.results.new.see_results"), officing_poll_results_path(@poll, date: l(date), booth_assignment_id: booth_assignment) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user