.
This commit is contained in:
@@ -31,7 +31,7 @@ bank_holidays = BankHolidays()
|
||||
bank_holiday_map = {}
|
||||
for bank_holiday in bank_holidays.get_holidays():
|
||||
bank_holiday_map[bank_holiday['date']] = bank_holiday['title']
|
||||
# see BankHolidays source file for more methods and arguments…
|
||||
# see BankHolidays source file for more methods and arguments
|
||||
|
||||
|
||||
class SingleShift(object):
|
||||
@@ -92,7 +92,9 @@ class RotaBuilder(object):
|
||||
balance_offset_modifier=1,
|
||||
ltft_balance_offset=4,
|
||||
max_night_frequency=2,
|
||||
max_weekend_frequency=2):
|
||||
max_weekend_frequency=2,
|
||||
use_previous_shifts=True,
|
||||
):
|
||||
|
||||
print("Start time: {}".format(datetime.datetime.now()))
|
||||
|
||||
@@ -104,6 +106,8 @@ class RotaBuilder(object):
|
||||
|
||||
self.weeks_days_product = list(itertools.product(self.weeks, days))
|
||||
|
||||
self.use_previous_shifts = use_previous_shifts
|
||||
|
||||
if start_date.weekday() != 0:
|
||||
raise ValueError("Start date {} must be a Mon (not a {})".format(
|
||||
start_date.isoformat(), days[start_date.weekday()]))
|
||||
@@ -644,6 +648,12 @@ class RotaBuilder(object):
|
||||
full_time_equivalent_joined *
|
||||
worker.fte_adj)
|
||||
|
||||
if self.use_previous_shifts:
|
||||
if shift in worker.previous_shifts:
|
||||
worked, allocated = worker.previous_shifts[shift]
|
||||
target_shifts = target_shifts + allocated - worked
|
||||
|
||||
|
||||
worker.shift_target_number[shift.name] = target_shifts
|
||||
|
||||
if shift.hard_constrain_shift:
|
||||
|
||||
Reference in New Issue
Block a user