From eb66c43def906d54aec588c69ea195f06bd2bcd5 Mon Sep 17 00:00:00 2001 From: Belissimo_T Date: Thu, 16 Nov 2023 21:26:56 +0100 Subject: [PATCH 1/3] deactivate taro.get_teachers --- backend/schools/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/schools/__init__.py b/backend/schools/__init__.py index 60622ba..a65db59 100644 --- a/backend/schools/__init__.py +++ b/backend/schools/__init__.py @@ -6,7 +6,7 @@ teacher_scrapers: dict[str, typing.Callable[[], list[Teacher]]] = { "10001329": ostwald.scrape_teachers, - "10453929": taro.get_teachers, + # "10453929": taro.get_teachers, } room_parsers: dict[str, typing.Callable[[str], Room]] = { From 6692dcff3453e5f07ca138ac4459206e2e483165 Mon Sep 17 00:00:00 2001 From: Belissimo_T Date: Fri, 17 Nov 2023 19:12:17 +0100 Subject: [PATCH 2/3] add timestamp log message to plan migration --- backend/plan_processor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/plan_processor.py b/backend/plan_processor.py index bd228d8..dc0eecd 100644 --- a/backend/plan_processor.py +++ b/backend/plan_processor.py @@ -58,9 +58,10 @@ def update_plans(self, day: datetime.date, timestamp: datetime.datetime) -> bool if (cur_ver := self.cache.get_plan_file(day, timestamp, ".processed")) == self.VERSION: return False - self._logger.info(f"=> Migrating plan for {day!s} to current version... ({cur_ver!r} -> {self.VERSION!r})") + self._logger.info(f"=> Migrating plan for {day!s} {timestamp!s} to current version... " + f"({cur_ver!r} -> {self.VERSION!r})") else: - self._logger.info(f"=> Processing plan for {day!s}...") + self._logger.info(f"=> Processing plan for {day!s} {timestamp!s}...") self.compute_plans(day, timestamp) From 9f9a680ad71d9662e95bd8ea31a32ec727376dc6 Mon Sep 17 00:00:00 2001 From: Belissimo_T Date: Sun, 19 Nov 2023 00:25:57 +0100 Subject: [PATCH 3/3] fix exception caused by malformed "Teacher (Stunde)" --- backend/vplan_utils.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/backend/vplan_utils.py b/backend/vplan_utils.py index 932748a..abb3aee 100644 --- a/backend/vplan_utils.py +++ b/backend/vplan_utils.py @@ -221,16 +221,19 @@ def periods_to_block_label(periods: typing.Iterable[int]) -> str: def _parse_periods(period_str: str) -> list[int]: - def period_str_to_int(string: str) -> int: - return int(string.replace("Stunde", "").replace(".", "")) + try: + def period_str_to_int(string: str) -> int: + return int(string.replace("Stunde", "").replace(".", "")) - if not period_str: + if not period_str: + return [] + elif "-" not in period_str: + return [period_str_to_int(period_str)] + else: + begin, end = period_str.split("-") + return list(range(period_str_to_int(begin), period_str_to_int(end) + 1)) + except ValueError: return [] - elif "-" not in period_str: - return [period_str_to_int(period_str)] - else: - begin, end = period_str.split("-") - return list(range(period_str_to_int(begin), period_str_to_int(end) + 1)) def parse_periods(period_str: str) -> set[int]: