.
This commit is contained in:
@@ -24,7 +24,7 @@ allow = 2000
|
||||
|
||||
sites = ("truro", "exeter", "torquay", "barnstaple", "plymouth")
|
||||
|
||||
Rota = RotaBuilder(datetime.date(2020, 9, 7),
|
||||
Rota = RotaBuilder(datetime.date(2021, 3, 8),
|
||||
weeks_to_rota=weeks_to_rota,
|
||||
balance_offset_modifier=1,
|
||||
max_weekend_frequency=2,
|
||||
@@ -37,7 +37,7 @@ Rota.constraint_options["constrain_time_off_after_nights"] = True
|
||||
Rota.constraint_options["balance_nights_across_sites"] = True
|
||||
Rota.constraint_options["balance_blocks"] = True
|
||||
Rota.constraint_options["balance_weekends"] = True
|
||||
Rota.constraint_options["avoid_st1_first_month"] = True
|
||||
Rota.constraint_options["avoid_st1_first_month"] = False
|
||||
Rota.constraint_options["max_weekends"] = 10
|
||||
Rota.constraint_options["prevent_monday_and_tuesday_after_full_weekends"] = [
|
||||
"truro", "torquay", "exeter"
|
||||
@@ -55,36 +55,41 @@ Rota.add_shifts(
|
||||
"torquay_twilight",
|
||||
12.5,
|
||||
days[:4],
|
||||
balance_offset=4,
|
||||
assign_as_block=True),
|
||||
SingleShift(("plymouth", ),
|
||||
"plymouth_twilight",
|
||||
12.5,
|
||||
days[:5],
|
||||
balance_offset=4,
|
||||
workers_required=1,
|
||||
constraints=["max_2_consecutive_shifts_per_week"]),
|
||||
SingleShift(("exeter", ),
|
||||
"weekend_exeter",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=4,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True),
|
||||
SingleShift(("truro", ),
|
||||
"weekend_truro",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=1,
|
||||
balance_offset=4,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True),
|
||||
SingleShift(("torquay", ),
|
||||
"weekend_torquay",
|
||||
12.5,
|
||||
days[4:],
|
||||
balance_offset=4,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True),
|
||||
SingleShift(("plymouth", ),
|
||||
"weekend_plymouth1",
|
||||
8,
|
||||
days[5:],
|
||||
balance_offset=4,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True),
|
||||
@@ -92,6 +97,7 @@ Rota.add_shifts(
|
||||
"weekend_plymouth2",
|
||||
8,
|
||||
days[5:],
|
||||
balance_offset=4,
|
||||
workers_required=1,
|
||||
rota_on_nwds=True,
|
||||
force_as_block=True),
|
||||
@@ -123,7 +129,7 @@ Rota.add_shifts(
|
||||
|
||||
use_test_workers = False
|
||||
|
||||
load_leave = True
|
||||
load_leave = False
|
||||
Rota.build_shifts_and_workers()
|
||||
|
||||
if load_leave:
|
||||
@@ -192,7 +198,7 @@ else:
|
||||
for row in reader:
|
||||
n = n + 1
|
||||
|
||||
name, site, grade, fte, nwd, end_date, oop, extra = row
|
||||
name, site, grade, fte, nwd, end_date, oop, twi, twi_we, night, night_we, extra = row
|
||||
|
||||
# Ignore trainees if fte == 0 (what are they doing here anyway)
|
||||
if int(fte) < 1:
|
||||
@@ -202,7 +208,28 @@ else:
|
||||
end_date = end_date if end_date else None
|
||||
oop = oop.split("-") if oop else None
|
||||
|
||||
previous_shifts = {}
|
||||
if twi:
|
||||
worked = twi.split(" ")[0]
|
||||
allocated = twi.split(" ")[1][1:-1]
|
||||
previous_shifts["{}_twilight".format(site.lower())] = (worked, allocated)
|
||||
if twi_we:
|
||||
worked = twi_we.split(" ")[0]
|
||||
allocated = twi_we.split(" ")[1][1:-1]
|
||||
previous_shifts["weekend_{}".format(site.lower())] = (worked, allocated)
|
||||
if night:
|
||||
worked = night.split(" ")[0]
|
||||
allocated = night.split(" ")[1][1:-1]
|
||||
previous_shifts["night_weekday".format(site.lower())] = (worked, allocated)
|
||||
if night_we:
|
||||
worked = night_we.split(" ")[0]
|
||||
allocated = night_we.split(" ")[1][1:-1]
|
||||
previous_shifts["night_weekend".format(site.lower())] = (worked, allocated)
|
||||
|
||||
|
||||
leave_requests = []
|
||||
work_requests = []
|
||||
site_pref = 1
|
||||
if load_leave:
|
||||
if name not in leave:
|
||||
raise ValueError(
|
||||
@@ -254,7 +281,8 @@ else:
|
||||
oop,
|
||||
not_available_to_work=leave_requests,
|
||||
work_requests=work_requests,
|
||||
night_at_derriford=site_pref))
|
||||
night_at_derriford=site_pref,
|
||||
previous_shifts=previous_shifts))
|
||||
|
||||
print("Building model")
|
||||
Rota.build_shifts_and_workers()
|
||||
|
||||
Reference in New Issue
Block a user