🐛 fix: declined events not cancelled

Events were declined but not cancelled what lead to a loop of allready declined events getting declined again in every run.
This commit is contained in:
Marc Koch 2025-07-14 19:54:20 +02:00
parent f053f4456f
commit 14dd63ad72
Signed by: marc
GPG Key ID: 12406554CFB028B9
1 changed files with 4 additions and 1 deletions

View File

@ -76,6 +76,7 @@ def clear(target_calendars: list, is_test: bool=False) -> dict:
end=date.today() + timedelta(days=horizon), end=date.today() + timedelta(days=horizon),
event=True, event=True,
expand=True, expand=True,
split_expanded=True,
) )
events = [] 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 # Delete cancelled non-recurring events if not in test mode
if (component.name == "VEVENT" if (component.name == "VEVENT"
and is_cancelled_event(event) and is_cancelled_event(event)
and not event.is_recurring): and not is_recurring_event(event)):
if not is_test: if not is_test:
event.delete() event.delete()
@ -189,6 +190,8 @@ def clear(target_calendars: list, is_test: bool=False) -> dict:
elif not event.is_cancelled: elif not event.is_cancelled:
if not is_test: if not is_test:
event.obj.decline_invite() event.obj.decline_invite()
event.obj.icalendar_component["status"] = "CANCELLED"
event.obj.save()
is_cancelled = True is_cancelled = True
result["cancellation_type"] = "cancelled" result["cancellation_type"] = "cancelled"
results["cancelled_overlapping_recurring_events"].append(result) results["cancelled_overlapping_recurring_events"].append(result)