Files
gitea-pages/scripts/schedule.py
2025-10-17 23:13:01 +02:00

62 lines
2.3 KiB
Python

import datetime as dt
def add2dict(datadict, d):
cw = d.isocalendar()[1]
y = d.isocalendar()[0] # to avoid last days of year being mapped into first calender week of same year
ts = d.strftime('%a., %d.%m.%Y')
if y not in datadict.keys():
datadict[y] = {}
if cw not in datadict[y].keys():
datadict[y][cw] = []
datadict[y][cw].append(ts)
return
year = 2026
firstday = dt.datetime(year, 7, 20)
lastday = dt.datetime(year, 8, 9)
datadict = {}
d = firstday
while d != lastday + dt.timedelta(days=1):
add2dict(datadict, d)
d = d + dt.timedelta(days=1)
for cw in datadict[year]:
print('### KW{:02}'.format(cw))
print('{{ScheduleTableHead()}}')
for ts in datadict[year][cw]:
print('| **{:}** {{_}} |'.format(ts))
print('| `00:00 - 24:00` | {{TunnelFr}} | Shutdown | {{Juri}} and {{Elmar}} |')
# if ts[:4] in ['Sat.', 'Sun.']:
# print('| `00:00 - 24:00` | {{Unstable}} | Vacuum scrubbing | OP shift crew |')
# else:
# print('| `00:00 - 07:00` | {{Unstable}} | Vacuum scrubbing | OP shift crew |')
# print('| `07:00 - 24:00` | {{Unstable}} | Phase 2 commissioning | Machine experts |')
# if ts[:4] == 'Tue.':
# print('| `00:00 - 07:00` | {{TopUp400}} | Beamline development | OP shift crew |')
# print('| `07:00 - 09:00` | {{No_Light}} | Operator training | {{Felix}} and OP shift crew |')
# print('| `09:00 - 14:00` | {{No_Light}} | Machine development | Machine experts |')
# print('| `14:00 - 19:00` | {{No_Light}} | Machine development | Machine experts |')
# print('| `19:00 - 24:00` | {{No_Light}} | Machine development | Machine experts |')
# elif ts[:4] == 'Wed.':
# print('| `00:00 - 06:00` | {{No_Light}} | Machine development | Machine experts |')
# print('| `06:00 - 07:00` | {{Unstable}} | Machine startup | OP shift crew |')
# # print('| `07:00 - 17:00` | {{Unstable}} | Dedicated beamline development | Machine experts |')
# print('| `00:00 - 24:00` | {{TopUp400}} | Beamline development | OP shift crew |')
# else:
# print('| `00:00 - 24:00` | {{TopUp400}} | Beamline development | OP shift crew |')
print()