displays results for booth

This commit is contained in:
rgarcia
2017-10-18 20:25:36 +02:00
parent cf400f3082
commit 34ee16a1c1
3 changed files with 26 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController
@booth_assignment = @poll.booth_assignments.includes(:recounts, :voters, @booth_assignment = @poll.booth_assignments.includes(:recounts, :voters,
officer_assignments: [officer: [:user]]).find(params[:id]) officer_assignments: [officer: [:user]]).find(params[:id])
@voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date} @voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date}
@partial_results = @booth_assignment.partial_results
end end
def create def create

View File

@@ -0,0 +1,11 @@
<div id="poll-resources">
<h3><%= t("admin.results.index.title") %></h3>
<% if @partial_results.empty? %>
<div class="callout primary margin-top">
<%= t("admin.results.index.no_results") %>
</div>
<% else %>
<%= render "admin/poll/results/result" %>
<% end %>
</div>

View File

@@ -17,9 +17,12 @@
<li class="tabs-title"> <li class="tabs-title">
<%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %> <%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
</li> </li>
<li class="tabs-title is-active"> <li class="tabs-title">
<%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %> <%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
</li> </li>
<li class="tabs-title">
<%= link_to "Results", "#tab-results" %>
</li>
</ul> </ul>
<div class="tabs-panel" id="tab-officers"> <div class="tabs-panel" id="tab-officers">
@@ -43,7 +46,7 @@
<% end %> <% end %>
</div> </div>
<div class="tabs-panel is-active" id="tab-recounts"> <div class="tabs-panel" id="tab-recounts">
<h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3> <h3><%= t("admin.poll_booth_assignments.show.recounts_list") %></h3>
<table id="totals"> <table id="totals">
@@ -55,8 +58,12 @@
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td class="text-center" id="total_final"><%= total_recounts_by_booth(@booth_assignment) || '-' %></td> <td class="text-center" id="total_final">
<td class="text-center" id="total_system"><%= @booth_assignment.voters.count %></td> <%= total_recounts_by_booth(@booth_assignment) || '-' %>
</td>
<td class="text-center" id="total_system">
<%= @booth_assignment.voters.count %>
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@@ -79,4 +86,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="tabs-panel is-active" id="tab-results">
<%= render "results" %>
</div>
</div> </div>