-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.py
49 lines (47 loc) · 2.18 KB
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from typing import Iterable
from day import Day
from time_slot import Duration, TimeInstance, TimePoint, TimeSlot
def time_slots(credits: int) -> Iterable[TimeSlot]:
"""
returns all possible time slots
"""
SHORT: Duration = Duration(50)
LONG: Duration = Duration(110)
if credits == 3:
for (h, m) in [(8, 0), (9, 0), (10, 0), (11, 0), (12, 0), (13, 0), (14, 0), (15, 0), (16, 0)]:
yield TimeSlot([
TimeInstance(Day.MON, TimePoint.make_from(h, m), SHORT),
TimeInstance(Day.WED, TimePoint.make_from(h, m), SHORT),
TimeInstance(Day.FRI, TimePoint.make_from(h, m), SHORT)
])
elif credits == 4:
# TR
for (h, m) in [(8, 0), (9, 0), (10, 0), (13, 10), (14, 10), (15, 10)]:
yield TimeSlot([
TimeInstance(Day.TUE, TimePoint.make_from(h, m), LONG),
TimeInstance(Day.THU, TimePoint.make_from(h, m), LONG)
], lab_index=1)
for lab in [Day.TUE, Day.THU]:
for hh in [h, h + 1]:
yield TimeSlot([
TimeInstance(
Day.MON, TimePoint.make_from(hh, 0), SHORT),
TimeInstance(lab, TimePoint.make_from(h, m), LONG),
TimeInstance(
Day.FRI, TimePoint.make_from(hh, 0), SHORT)
], lab_index=1)
# W
for (h, m) in [(8, 0), (9, 0), (10, 0), (11, 0), (12, 0), (13, 0)]:
for hh in [h, h + 1]:
yield TimeSlot([
TimeInstance(Day.MON, TimePoint.make_from(hh, 0), SHORT),
TimeInstance(Day.WED, TimePoint.make_from(h, m), LONG),
TimeInstance(Day.FRI, TimePoint.make_from(hh, 0), SHORT)
], lab_index=1)
# evenings
for (h, m) in [(16, 0), (16, 30), (17, 0), (17, 30), (18, 0), (18, 30)]:
for (d1, d2) in [(Day.MON, Day.WED), (Day.TUE, Day.THU)]:
yield TimeSlot([
TimeInstance(d1, TimePoint.make_from(h, m), LONG),
TimeInstance(d2, TimePoint.make_from(h, m), LONG)
], lab_index=1)