Enable and fix booth selection back
This commit is contained in:
@@ -27,7 +27,14 @@ class Officing::BaseController < ApplicationController
|
||||
end
|
||||
|
||||
def verify_booth
|
||||
if current_booth.blank?
|
||||
return unless current_booth.blank?
|
||||
booths = todays_booths_for_officer(current_user.poll_officer)
|
||||
case booths.count
|
||||
when 0
|
||||
redirect_to officing_root_path
|
||||
when 1
|
||||
session[:booth_id] = booths.first.id
|
||||
else
|
||||
redirect_to new_officing_booth_path
|
||||
end
|
||||
end
|
||||
@@ -36,4 +43,8 @@ class Officing::BaseController < ApplicationController
|
||||
Poll::Booth.where(id: session[:booth_id]).first
|
||||
end
|
||||
|
||||
def todays_booths_for_officer(officer)
|
||||
officer.officer_assignments.by_date(Date.today).map(&:booth).uniq
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user