diff --git a/backend/events.py b/backend/events.py index 4d1c653..fc92939 100644 --- a/backend/events.py +++ b/backend/events.py @@ -27,6 +27,7 @@ def get_base_dict(self): @dataclasses.dataclass class PlanDownload(Event): plan_type: str # Ex: "PlanKl.xml" or "VPlanKl.xml" + date: datetime.date last_modified: datetime.datetime file_length: int diff --git a/backend/load_plans.py b/backend/load_plans.py index 6da3483..7c040a8 100644 --- a/backend/load_plans.py +++ b/backend/load_plans.py @@ -89,14 +89,14 @@ async def get_crawlers(session: aiohttp.ClientSession | None = None, ) hosting = Hosting.deserialize(data["hosting"]) - client = IndiwareStundenplanerClient(hosting, session) - if hosting.creds is not None and hosting.creds.username == "schueler": logger.warning("* Disabling room and teacher plans because only student creds are available.") # avoid trying to fetch room and teacher plans if no creds are available - client.teacher_plan_client = None - client.room_plan_client = None - client.teachers_substitution_plan_client = None + hosting.indiware_mobil.rooms = None + hosting.indiware_mobil.teachers = None + hosting.substitution_plan.teachers = None + + client = IndiwareStundenplanerClient(hosting, session) for plan_client in client.substitution_plan_clients: plan_client.proxy_provider = proxy_provider diff --git a/backend/plan_downloader.py b/backend/plan_downloader.py index 06a3492..2464a64 100644 --- a/backend/plan_downloader.py +++ b/backend/plan_downloader.py @@ -148,7 +148,7 @@ async def download_indiware_mobil( ) await timer.submit_async(plan_type=plan_filename, last_modified=plan_response.last_modified, - file_length=len(plan_response.content)) + file_length=len(plan_response.content), date=date) self.cache.store_plan_file(date, revision, plan_response.content, plan_filename) self.cache.store_plan_file(date, revision, json.dumps(downloaded_file.serialize()),