From 9fd02c21d11843c88c6a262a3fbb9f6f946dbff2 Mon Sep 17 00:00:00 2001 From: Felix Blanke <info@fblanke.de> Date: Thu, 23 Jan 2025 16:55:06 +0100 Subject: [PATCH] Add other slots of same AK to conflict list --- AKModel/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AKModel/models.py b/AKModel/models.py index 78a8ccb3..1b97742a 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -1012,6 +1012,8 @@ class AKSlot(models.Model): conflict_slots = AKSlot.objects.filter(ak__in=self.ak.conflicts.all()) dependency_slots = AKSlot.objects.filter(ak__in=self.ak.prerequisites.all()) + other_ak_slots = AKSlot.objects.filter(ak=self.ak).exclude(pk=self.pk) + ceil_offet_eps = decimal.Decimal(1e-4) # self.slots_in_an_hour is set in AKJSONExportView @@ -1019,7 +1021,9 @@ class AKSlot(models.Model): "id": str(self.pk), "duration": math.ceil(self.duration * self.slots_in_an_hour - ceil_offet_eps), "properties": { - "conflicts": [str(conflict.pk) for conflict in conflict_slots.all()], + "conflicts": + [str(conflict.pk) for conflict in conflict_slots.all()] + + [str(second_slot.pk) for second_slot in other_ak_slots.all()], "dependencies": [str(dep.pk) for dep in dependency_slots.all()], }, "room_constraints": [constraint.name -- GitLab