From 97a7968b08599684d54330c758e8193a7d55ec38 Mon Sep 17 00:00:00 2001 From: PetJer Date: Mon, 16 Oct 2023 19:42:27 +0200 Subject: [PATCH 1/2] Changed column for reading --- API/gimvicurnik/updaters/eclassroom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/gimvicurnik/updaters/eclassroom.py b/API/gimvicurnik/updaters/eclassroom.py index 291af34..fa82de5 100644 --- a/API/gimvicurnik/updaters/eclassroom.py +++ b/API/gimvicurnik/updaters/eclassroom.py @@ -755,7 +755,7 @@ def _parse_lunch_schedule_xlsx(self, stream: BytesIO, effective: date) -> None: # Parse lunch schedule for ws in wb: for wr in ws.iter_rows(min_row=3, max_col=5): - if not wr[0].value: + if not wr[2].value: break # Check for correct cell value type @@ -765,7 +765,7 @@ def _parse_lunch_schedule_xlsx(self, stream: BytesIO, effective: date) -> None: assert isinstance(wr[2].value, str) assert isinstance(wr[4].value, str) - if "prilagoditev" in wr[1].value: + if "raz" in wr[2].value: continue schedule: dict[str, Any] = {} From b068e110ac9870430cb2a234ce0910a4d46e7f5c Mon Sep 17 00:00:00 2001 From: PetJer Date: Mon, 16 Oct 2023 20:48:37 +0200 Subject: [PATCH 2/2] Changed end of day condition for menu parsing --- API/gimvicurnik/updaters/menu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/API/gimvicurnik/updaters/menu.py b/API/gimvicurnik/updaters/menu.py index 3f38995..e7e455b 100644 --- a/API/gimvicurnik/updaters/menu.py +++ b/API/gimvicurnik/updaters/menu.py @@ -219,7 +219,7 @@ def _parse_snack_menu_xlsx(self, stream: BytesIO, effective: datetime.date) -> N snack_menu["fruitvegetable"].append(wr[4].value.strip()) # Store the menu after the end of day - if wr[1].border.bottom.color: + if wr[1].value.strip() == "med odmori - sadje na hodnikih": snack_menu["date"] = effective + datetime.timedelta(days=days) self.session.query(SnackMenu).filter(SnackMenu.date == snack_menu["date"]).delete() @@ -312,7 +312,7 @@ def _parse_lunch_menu_xlsx(self, stream: BytesIO, effective: datetime.date) -> N lunch_menu["vegetarian"].append(wr[2].value.strip()) # Store the menu after the end of day - if wr[1].border.bottom.color: + if wr[1].value.strip() == "voda ali sok": lunch_menu["date"] = effective + datetime.timedelta(days=days) self.session.query(LunchMenu).filter(LunchMenu.date == lunch_menu["date"]).delete()