From 3302a7abf80a48cc14b6039bb2b3b929dc7540e3 Mon Sep 17 00:00:00 2001 From: Marc Koch Date: Thu, 4 Sep 2025 11:05:44 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20overlap=20detection=20logi?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/clear_bookings.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/clear_bookings.py b/src/clear_bookings.py index 694eb4d..a2bb325 100644 --- a/src/clear_bookings.py +++ b/src/clear_bookings.py @@ -472,10 +472,8 @@ def find_overlapping_events(events: list[DavEvent]) -> dict: if event.uid == compare_event.uid: continue - # Skip if the compare_event is already in the overlapping events - # dictionary or if it is already canceled - if (overlapping_events.get(compare_event.extended_uid) - or compare_event.is_cancelled): + # Skip if the compare_event is already canceled + if compare_event.is_cancelled: continue # Check if the events overlap @@ -497,12 +495,12 @@ def find_overlapping_events(events: list[DavEvent]) -> dict: continue # Add to overlapping events dictionary - if e := overlapping_events.get(event.extended_uid): + if e := overlapping_events.get(compare_event.extended_uid): # If the event is already in the dictionary, extend the overlaps e["overlaps_with"].append(event) else: # Create a new entry for the overlapping event - overlapping_events[event.extended_uid] = { + overlapping_events[compare_event.extended_uid] = { "event": compare_event, "overlaps_with": [event] }