Skip to content

Commit

Permalink
Merge pull request #36 from filips123/fix-lunch-schedule-and-menu-upd…
Browse files Browse the repository at this point in the history
…aters
  • Loading branch information
filips123 authored Sep 26, 2021
2 parents 7748cdb + 425987a commit 0b97b83
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion API/gimvicurnik/updaters/eclassroom.py
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,9 @@ def _parse_daily_lunch_schedule(self, date, tables):
row[0] = times[0]
table[index + 1][0] = times[1]

# Handle different time formats
row[0] = row[0].strip().replace(".", ":")

# Skip header
if row[0] and "ura" in row[0]:
continue
Expand All @@ -549,7 +552,7 @@ def _parse_daily_lunch_schedule(self, date, tables):
continue

is_time_valid = row[0] and row[0].strip() != "do"
time = datetime.datetime.strptime(row[0].strip(), "%H:%M").time() if is_time_valid else last_hour
time = datetime.datetime.strptime(row[0], "%H:%M").time() if is_time_valid else last_hour
last_hour = time

notes = row[1].strip() if row[0] else last_notes
Expand Down
10 changes: 8 additions & 2 deletions API/gimvicurnik/updaters/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ def _store_snack_menu(self, url, date, span):

# Parse tables into menus and store them
for table in tables:
for row in table[1::2]:
for row in table:
if "NV in N" in row[1]:
continue

current = date + datetime.timedelta(days=days)
days += 1

Expand Down Expand Up @@ -328,7 +331,10 @@ def _store_lunch_menu(self, url, date, span):

# Parse tables into menus and store them
for table in tables:
for row in table[1::2]:
for row in table:
if "N KOSILO" in row[1]:
continue

current = date + datetime.timedelta(days=days)
days += 1

Expand Down

0 comments on commit 0b97b83

Please sign in to comment.