From 423b65766054a23c384bb64e05b0b2f7ceae008c Mon Sep 17 00:00:00 2001 From: "N. Geisler" <ngeisler@fachschaft.informatik.tu-darmstadt.de> Date: Thu, 13 May 2021 03:23:11 +0200 Subject: [PATCH] fix constraint checking bugs --- AKModel/models.py | 2 +- AKScheduling/models.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AKModel/models.py b/AKModel/models.py index b2f15fd5..70cc217d 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -425,7 +425,7 @@ class AKSlot(models.Model): return (timezone.now() - self.updated).total_seconds() def overlaps(self, other: "AKSlot"): - return self.start <= other.end <= self.end or self.start <= other.start <= self.end + return self.start < other.end <= self.end or self.start <= other.start < self.end class AKOrgaMessage(models.Model): diff --git a/AKScheduling/models.py b/AKScheduling/models.py index 769b2ece..24f544f1 100644 --- a/AKScheduling/models.py +++ b/AKScheduling/models.py @@ -325,11 +325,11 @@ def akslot_changed_handler(sender, instance: AKSlot, **kwargs): print(f"Multiple slots in room {instance.room}: {new_violations}") - # ... and compare to/update list of existing violations of this type - # belonging to the slot that was recently changed (important!) - existing_violations_to_check = list(instance.constraintviolation_set.filter(type=violation_type)) - # print(existing_violations_to_check) - update_constraint_violations(new_violations, existing_violations_to_check) + # ... and compare to/update list of existing violations of this type + # belonging to the slot that was recently changed (important!) + existing_violations_to_check = list(instance.constraintviolation_set.filter(type=violation_type)) + # print(existing_violations_to_check) + update_constraint_violations(new_violations, existing_violations_to_check) # == Check for reso ak after reso deadline == -- GitLab