🐛 fix overlap detection logic
This commit is contained in:
parent
11c6d4d48e
commit
3302a7abf8
|
|
@ -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]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue