From 34ee16a1c191179c5be4847788263e5256cf989a Mon Sep 17 00:00:00 2001 From: rgarcia Date: Wed, 18 Oct 2017 20:25:36 +0200 Subject: [PATCH] displays results for booth --- .../admin/poll/booth_assignments_controller.rb | 1 + .../poll/booth_assignments/_results.html.erb | 11 +++++++++++ .../admin/poll/booth_assignments/show.html.erb | 18 ++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 app/views/admin/poll/booth_assignments/_results.html.erb diff --git a/app/controllers/admin/poll/booth_assignments_controller.rb b/app/controllers/admin/poll/booth_assignments_controller.rb index 8ffa455c8..c9f95de30 100644 --- a/app/controllers/admin/poll/booth_assignments_controller.rb +++ b/app/controllers/admin/poll/booth_assignments_controller.rb @@ -18,6 +18,7 @@ class Admin::Poll::BoothAssignmentsController < Admin::Poll::BaseController @booth_assignment = @poll.booth_assignments.includes(:recounts, :voters, officer_assignments: [officer: [:user]]).find(params[:id]) @voters_by_date = @booth_assignment.voters.group_by {|v| v.created_at.to_date} + @partial_results = @booth_assignment.partial_results end def create diff --git a/app/views/admin/poll/booth_assignments/_results.html.erb b/app/views/admin/poll/booth_assignments/_results.html.erb new file mode 100644 index 000000000..224da76ab --- /dev/null +++ b/app/views/admin/poll/booth_assignments/_results.html.erb @@ -0,0 +1,11 @@ +
+

<%= t("admin.results.index.title") %>

+ + <% if @partial_results.empty? %> +
+ <%= t("admin.results.index.no_results") %> +
+ <% else %> + <%= render "admin/poll/results/result" %> + <% end %> +
\ No newline at end of file diff --git a/app/views/admin/poll/booth_assignments/show.html.erb b/app/views/admin/poll/booth_assignments/show.html.erb index fd303d099..5f80f2617 100644 --- a/app/views/admin/poll/booth_assignments/show.html.erb +++ b/app/views/admin/poll/booth_assignments/show.html.erb @@ -17,9 +17,12 @@
  • <%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
  • -
  • +
  • <%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
  • +
  • + <%= link_to "Results", "#tab-results" %> +
  • @@ -43,7 +46,7 @@ <% end %>
    -
    +

    <%= t("admin.poll_booth_assignments.show.recounts_list") %>

    @@ -55,8 +58,12 @@ - - + +
    <%= total_recounts_by_booth(@booth_assignment) || '-' %><%= @booth_assignment.voters.count %> + <%= total_recounts_by_booth(@booth_assignment) || '-' %> + + <%= @booth_assignment.voters.count %> +
    @@ -79,4 +86,7 @@
    +
    + <%= render "results" %> +