Skip to content

Commit

Permalink
Merge pull request #92 from filips123/fix-empty-lunch-time
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 authored Nov 13, 2023
2 parents 298647c + d8a7802 commit 5594438
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
14 changes: 9 additions & 5 deletions API/gimvicurnik/blueprints/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,20 @@ def create_schedule_calendar(
span.set_tag("event.time", model.time)
span.set_data("event.source", model)

# Skip schedules without time
if not model.time:
logger.debug(
"Skipping iCalendar event",
extra={"type": "lunch-schedule", "source": model},
)

continue

logger.debug(
"Preparing iCalendar event",
extra={"type": "lunch-schedule", "source": model},
)

# Assert date and time exist, so mypy does not complain
if typing.TYPE_CHECKING:
assert model.date
assert model.time

# Create event and add internal properties
event = Event()
event.add("DTSTAMP", datetime.now())
Expand Down
4 changes: 2 additions & 2 deletions API/gimvicurnik/blueprints/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def get_lunch_schedule(date: datetime.date) -> list[dict[str, Any]]:
{
"class": model[1],
"date": model[0].date.strftime("%Y-%m-%d"),
"time": model[0].time.strftime("%H:%M"),
"time": model[0].time.strftime("%H:%M") if model[0].time else None,
"location": model[0].location,
"notes": model[0].notes,
}
Expand All @@ -41,7 +41,7 @@ def get_lunch_schedule_for_classes(date: datetime.date, classes: list[str]) -> l
{
"class": model[1],
"date": model[0].date.strftime("%Y-%m-%d"),
"time": model[0].time.strftime("%H:%M"),
"time": model[0].time.strftime("%H:%M") if model[0].time else None,
"location": model[0].location,
"notes": model[0].notes,
}
Expand Down
4 changes: 2 additions & 2 deletions website/src/store/modules/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface DisplayedLesson {
export interface LunchSchedule {
class: string;
date: string;
time: string;
location: string;
time: string | null;
location: string | null;
notes: string | null;
}

Expand Down

0 comments on commit 5594438

Please sign in to comment.