mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
fix ba3 schedule
This commit is contained in:
parent
ad1175f6cd
commit
51811dd9f9
3 changed files with 185 additions and 88 deletions
|
|
@ -143,6 +143,7 @@ class Schedule:
|
|||
self.schedule_dict: Dict = self.load_schedule_file()
|
||||
self.start_date = fromArray(self.schedule_dict["semester_start"])
|
||||
self.end_date = fromArray(self.schedule_dict["semester_end"])
|
||||
self._forward_to_semester()
|
||||
|
||||
# Semester is over
|
||||
if self.end_date < self.day:
|
||||
|
|
@ -167,6 +168,14 @@ class Schedule:
|
|||
|
||||
self.weekday_str = intToWeekday(self.day.weekday())
|
||||
|
||||
def _forward_to_semester(self):
|
||||
"""
|
||||
In case the semester hasn't started yet, fast forward the current date
|
||||
by a week until it's no longer necessary
|
||||
"""
|
||||
while self.day < self.start_date:
|
||||
self.day += timedelta(weeks=1)
|
||||
|
||||
def check_holidays(self):
|
||||
"""
|
||||
Do all holiday-related stuff here to avoid multiple loops
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue