Skip to content

Commit

Permalink
🐛 Update iCalendar syncing to only replace events when it succeeds to…
Browse files Browse the repository at this point in the history
… parse the iCalendar
  • Loading branch information
Jorricks committed Feb 27, 2024
1 parent 8269087 commit 7aefa1a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion duty_board/plugin/ical_plugin_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,14 @@ def _create_on_call_event(self, calendar: Calendar, v_event: VEvent, person: Per
)

def sync_calendar(self, calendar: Calendar, session: SASession) -> Calendar: # noqa: ARG002
# We first make sure we can actually fetch the calendar
parsed_events: List[VEvent]
parsed_events = self._get_events_for_upcoming_month(calendar.icalendar_url, calendar.event_prefix or "")

# Only when it was successfully fetched, we wipe the records.
calendar.events = []
event: VEvent
for event in self._get_events_for_upcoming_month(calendar.icalendar_url, calendar.event_prefix or ""):
for event in parsed_events:
# First attempt attendee. If that is not set, we look at the title/summary of the event.
person_unique_identifier: Optional[str] = None
if event.attendee is not None and any(event.attendee):
Expand Down

0 comments on commit 7aefa1a

Please sign in to comment.