Files
nairobi/app/controllers/admin/poll/recounts_controller.rb
Juanjo Bazán 26d1024cfc Add cumulative totals to admin poll recounts list
This commit backports commit AyuntamientoMadrid@90638672 and the changes
that code has been through:

* AyuntamientoMadrid@03371a71 removed daily recounts in the controller
* AyuntamientoMadrid@fe3492a7 removed daily recounts in the view
* AyuntamientoMadrid@aa59d995 replaced FinalRecount with TotalResult
* AyuntamientoMadrid@c40e8d79 replaced TotalResult with Recount
2019-03-07 02:09:17 +01:00

21 lines
681 B
Ruby

class Admin::Poll::RecountsController < Admin::Poll::BaseController
before_action :load_poll
def index
@booth_assignments = @poll.booth_assignments.
includes(:booth, :recounts, :voters).
order("poll_booths.name").
page(params[:page]).per(50)
@all_booths_counts = {
final: ::Poll::Recount.select(:total_amount).where(booth_assignment_id: @poll.booth_assignment_ids).sum(:total_amount),
system: ::Poll::Voter.where(booth_assignment_id: @poll.booth_assignment_ids).count
}
end
private
def load_poll
@poll = ::Poll.find(params[:poll_id])
end
end