Skip to content

Commit

Permalink
Lunch schedule fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PetJer committed Sep 18, 2023
1 parent 3be64c5 commit 73115b6
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions API/gimvicurnik/updaters/eclassroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,9 +754,6 @@ def _parse_lunch_schedule_xlsx(self, stream: BytesIO, effective: date) -> None:

# Parse lunch schedule
for ws in wb:
if ws.title != "kosilo":
continue

for wr in ws.iter_rows(min_row=3, max_col=5):
if not wr[0].value:
break
Expand All @@ -768,24 +765,25 @@ 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:
continue

schedule: dict[str, Any] = {}

# Time in format H:M
schedule["time"] = wr[0].value

# Notes
schedule["notes"] = wr[1].value.strip() if wr[1].value else None

# Class name (class id)
if wr[2].value:
schedule["class_id"] = get_or_create(self.session, model=Class, name=wr[2].value.strip())[
0
].id
# fmt: off
schedule["class_id"] = get_or_create(
self.session, model=Class, name=wr[2].value.strip()
)[0].id
# fmt: on

# Location
schedule["location"] = wr[4].value.strip() if wr[4].value else None

# Effective date
schedule["date"] = effective
lunch_schedule.append(schedule)

Expand Down

0 comments on commit 73115b6

Please sign in to comment.