adds index view for poll results in officing

This commit is contained in:
Juanjo Bazán
2017-02-02 16:10:40 +01:00
parent d9fa4bdc29
commit ec8d45f3cd
7 changed files with 120 additions and 3 deletions

View File

@@ -18,6 +18,17 @@ class Officing::ResultsController < Officing::BaseController
redirect_to new_officing_poll_result_path(@poll), notice: notice
end
def index
@booth_assignment = ::Poll::BoothAssignment.includes(:booth).find(index_params[:booth_assignment_id])
if current_user.poll_officer.officer_assignments.final.
where(booth_assignment_id: @booth_assignment.id).exists?
@partial_results = ::Poll::PartialResult.includes(:question).
where(booth_assignment_id: index_params[:booth_assignment_id]).
where(date: index_params[:date])
end
end
private
def check_booth_and_date
@@ -93,4 +104,8 @@ class Officing::ResultsController < Officing::BaseController
params.permit(:officer_assignment_id, :date, :questions)
end
def index_params
params.permit(:booth_assignment_id, :date)
end
end