From ae4297b627b181b8d0787489bce9a7d022e9a743 Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Wed, 22 May 2024 17:16:56 -0400 Subject: [PATCH] fix: simplify comparisons of start & end of timeslots --- program/services.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/program/services.py b/program/services.py index 59c5b86b..038f3089 100644 --- a/program/services.py +++ b/program/services.py @@ -668,7 +668,7 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts: solution_choices.add("theirs") solution_choices.add("ours") - # Partly overlapping: projected starts earlier than existing and ends earlier + # Partly overlapping: timeslot start before existing start, end before existing end # # ex. pr. # +--+ @@ -678,11 +678,11 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts: # | | # +--+ # - if timeslot.end > existing.start > timeslot.start <= existing.end: + if timeslot.start < existing.start and timeslot.end < existing.end: solution_choices.add("theirs-end") solution_choices.add("ours-end") - # Partly overlapping: projected starts later than existing and ends later + # Partly overlapping: timeslot start after existing start, end after existing ends # # ex. pr. # +--+ @@ -692,11 +692,11 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts: # | | # +--+ # - if existing.start <= timeslot.start < existing.end < timeslot.end: + if timeslot.start > existing.start and timeslot.end > existing.end: solution_choices.add("theirs-start") solution_choices.add("ours-start") - # Fully overlapping/Superset: projected starts earlier and ends later than existing + # Fully overlapping: timeslot start before existing start, end after existing end # # ex. pr. # +--+ @@ -710,7 +710,7 @@ def generate_conflicts(timeslots: list[TimeSlot]) -> Conflicts: solution_choices.add("theirs-start") solution_choices.add("theirs-both") - # Fully overlapping/Subset: projected starts later and ends earlier than existing + # Fully overlapping: timeslot start after existing start, end before existing end # # ex. pr. # +--+ -- GitLab