Extract inline query to an OfficerAssignment scope

This commit is contained in:
Bertocq
2018-02-19 00:08:47 +01:00
parent 118deb9fc4
commit 4fb9f6829c
2 changed files with 4 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ class Admin::Poll::OfficerAssignmentsController < Admin::Poll::BaseController
@officer_assignments = ::Poll::OfficerAssignment.
joins(:booth_assignment).
includes(:recounts, booth_assignment: :booth).
where("officer_id = ? AND poll_booth_assignments.poll_id = ?", @officer.id, @poll.id).
by_officer_and_poll(@officer.id, @poll.id).
order(:date)
end