diff --git a/src/clear_bookings.py b/src/clear_bookings.py index 2e467e5..82ed837 100644 --- a/src/clear_bookings.py +++ b/src/clear_bookings.py @@ -76,6 +76,7 @@ def clear(target_calendars: list, is_test: bool=False) -> dict: end=date.today() + timedelta(days=horizon), event=True, expand=True, + split_expanded=True, ) events = [] @@ -85,7 +86,7 @@ def clear(target_calendars: list, is_test: bool=False) -> dict: # Delete cancelled non-recurring events if not in test mode if (component.name == "VEVENT" and is_cancelled_event(event) - and not event.is_recurring): + and not is_recurring_event(event)): if not is_test: event.delete() @@ -189,6 +190,8 @@ def clear(target_calendars: list, is_test: bool=False) -> dict: elif not event.is_cancelled: if not is_test: event.obj.decline_invite() + event.obj.icalendar_component["status"] = "CANCELLED" + event.obj.save() is_cancelled = True result["cancellation_type"] = "cancelled" results["cancelled_overlapping_recurring_events"].append(result)