This commit is contained in:
Ross
2020-05-24 10:16:25 +01:00
parent 63dcc7ce78
commit a6326bcaf6
15 changed files with 1138 additions and 809 deletions
+17 -9
View File
@@ -23,8 +23,8 @@ sites = ("truro", "exeter", "torquay", "barnstaple", "plymouth")
Rota = RotaBuilder(datetime.date(2020, 9, 7),
weeks_to_rota=weeks_to_rota,
balance_offset_modifier=1,
max_weekend_frequency=1,
balance_offset_modifier=4,
max_weekend_frequency=2,
max_night_frequency=2)
rota_collections = {
@@ -300,7 +300,7 @@ with open('trainees.csv', newline='') as f:
name, site, grade, fte, nwd, end_date, oop, extra = row
# Ignore trainees if fte == 0 (what are they doing here anyway)
if fte == 0:
if fte == "0":
continue
nwds = nwd.split(",").title() if nwd else None
@@ -308,12 +308,20 @@ with open('trainees.csv', newline='') as f:
oop = oop.split("-") if oop else None
#print(nwds, end_date, oop)
for rot in rota_collections:
rota_collections[rot].add_worker(
Rota = rota_collections[rot]
Rota.add_worker(
Worker(Rota, n, name, site.lower(), int(grade[2]), int(fte),
nwds, end_date, oop))
with open("rotas.html", "w") as f:
f.write("<html><body>")
f.write("""<html>
<head>
<link rel="stylesheet" type="text/css" href="timetable.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="s.js" defer></script>
</head>
<body>""")
for rot in rota_collections:
print("Running rota: ", rot)
@@ -340,8 +348,8 @@ for rot in rota_collections:
Rota.model,
tee=True,
options={
"seconds": 3200,
"allow": 2200,
"seconds": 10200,
"allow": 2000,
},
logfile="{}.log".format(rot)
) # solve the model with the, options="seconds=60" selected solver
@@ -352,7 +360,7 @@ for rot in rota_collections:
week_table = ResultsHolder.get_work_table(
) # list with the required workers
worker_timetable = ResultsHolder.get_worker_timetable()
#worker_timetable = ResultsHolder.get_worker_timetable()
worker_timetable_brief = ResultsHolder.get_worker_timetable_brief(
show_prefs=False)
@@ -370,7 +378,7 @@ for rot in rota_collections:
f.write("\n")
f.write("\n\n")
f.write("<pre>{}</pre>".format(worker_timetable_brief))
f.write(ResultsHolder.get_worker_timetable_html(table_name=rot))
f.write("\n\n")
f.write("<pre>{}</pre>".format(worker_shift_summary))
f.write("\n\n\n")