Skip to content

Commit

Permalink
Merge pull request #240 from ArtrenH/main
Browse files Browse the repository at this point in the history
2023-11-19
  • Loading branch information
Belissimo-T authored Nov 18, 2023
2 parents 0d5498b + 9f9a680 commit ea3a624
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
5 changes: 3 additions & 2 deletions backend/plan_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion backend/schools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]] = {
Expand Down
19 changes: 11 additions & 8 deletions backend/vplan_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit ea3a624

Please sign in to comment.