88from pycamp_bot .logger import logger
99
1010
11+ LUNCH_TIME_START_HOUR = 13
12+ LUNCH_TIME_END_HOUR = 14
13+ WIZARD_TIME_START_HOUR = 9
14+ WIZARD_TIME_END_HOUR = 20
15+
16+
17+ def is_wizard_time_slot (slot ):
18+ return slot [0 ].hour in range (WIZARD_TIME_START_HOUR , WIZARD_TIME_END_HOUR )
19+
20+
21+ def is_lunch_time_slot (slot ):
22+ return slot [0 ].hour in range (LUNCH_TIME_START_HOUR , LUNCH_TIME_END_HOUR )
23+
24+
25+ def is_after_first_lunch_slot (pycamp , slot ):
26+ return slot [0 ].day != pycamp .start .day or slot [0 ].hour >= LUNCH_TIME_END_HOUR
27+
28+
29+
30+ def is_before_last_lunch_slot (pycamp , slot ):
31+ return slot [0 ].day != pycamp .end .day or slot [0 ].hour < LUNCH_TIME_START_HOUR
32+
33+
34+ def is_valid_wizard_slot (pycamp , slot ):
35+ return (
36+ is_wizard_time_slot (slot )
37+ and not is_lunch_time_slot (slot )
38+ and is_after_first_lunch_slot (pycamp , slot )
39+ and is_before_last_lunch_slot (pycamp , slot )
40+ )
41+
42+
43+ def clean_wizards_free_slots (pycamp , slots ):
44+ return [slot for slot in slots if is_valid_wizard_slot (pycamp , slot )]
45+
1146
1247def compute_wizards_slots (pycamp ):
1348 """
@@ -27,6 +62,8 @@ def compute_wizards_slots(pycamp):
2762 )
2863 current_period = slot_end
2964
65+ slots = clean_wizards_free_slots (pycamp , slots )
66+
3067 return slots
3168
3269
0 commit comments