Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xlsx parsing #87

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions API/gimvicurnik/updaters/eclassroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] = {}
Expand Down
4 changes: 2 additions & 2 deletions API/gimvicurnik/updaters/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()

Expand Down
Loading