Load the Booth polls instead of all current/incoming on Shift creation for date ranges
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
||||||
|
|
||||||
before_action :load_booth
|
before_action :load_booth
|
||||||
before_action :load_polls
|
|
||||||
before_action :load_officer
|
before_action :load_officer
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -39,10 +38,6 @@ class Admin::Poll::ShiftsController < Admin::Poll::BaseController
|
|||||||
@booth = ::Poll::Booth.find(params[:booth_id])
|
@booth = ::Poll::Booth.find(params[:booth_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_polls
|
|
||||||
@polls = ::Poll.current_or_incoming
|
|
||||||
end
|
|
||||||
|
|
||||||
def load_shifts
|
def load_shifts
|
||||||
@shifts = @booth.shifts
|
@shifts = @booth.shifts
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,12 +24,12 @@
|
|||||||
<div class="small-12 medium-3 column">
|
<div class="small-12 medium-3 column">
|
||||||
<label><%= t("admin.poll_shifts.new.date") %></label>
|
<label><%= t("admin.poll_shifts.new.date") %></label>
|
||||||
<%= select 'shift[date]', 'vote_collection_date',
|
<%= select 'shift[date]', 'vote_collection_date',
|
||||||
options_for_select(shift_vote_collection_dates(@polls)),
|
options_for_select(shift_vote_collection_dates(@booth.polls)),
|
||||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||||
label: false },
|
label: false },
|
||||||
class: 'js-shift-vote-collection-dates' %>
|
class: 'js-shift-vote-collection-dates' %>
|
||||||
<%= select 'shift[date]', 'recount_scrutiny_date',
|
<%= select 'shift[date]', 'recount_scrutiny_date',
|
||||||
options_for_select(shift_recount_scrutiny_dates(@polls)),
|
options_for_select(shift_recount_scrutiny_dates(@booth.polls)),
|
||||||
{ prompt: t("admin.poll_shifts.new.select_date"),
|
{ prompt: t("admin.poll_shifts.new.select_date"),
|
||||||
label: false },
|
label: false },
|
||||||
class: 'js-shift-recount-scrutiny-dates',
|
class: 'js-shift-recount-scrutiny-dates',
|
||||||
|
|||||||
@@ -31,6 +31,8 @@ feature 'Admin shifts' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do
|
scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do
|
||||||
|
create(:poll)
|
||||||
|
create(:poll, :incoming)
|
||||||
poll = create(:poll, :current)
|
poll = create(:poll, :current)
|
||||||
booth = create(:poll_booth)
|
booth = create(:poll_booth)
|
||||||
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||||
|
|||||||
Reference in New Issue
Block a user