Skip to content
Snippets Groups Projects
Commit cbbd0475 authored by Benjamin Hättasch's avatar Benjamin Hättasch Committed by Nadja Geisler
Browse files

Fix temporary m2m relations of constraint violation

Previously, ak and ak slot sets were modelled as class attributes, which could cause wrong AKs to show up in a relation when multiple constraints were updated in the same function call
parent 06b50a56
No related branches found
No related tags found
2 merge requests!100Scheduling Constraints WIP WIP WIP,!99Constraint Violation checking & visualization
......@@ -465,6 +465,11 @@ class ConstraintViolation(models.Model):
fields = ['ak_owner', 'room', 'requirement', 'category']
fields_mm = ['_aks', '_ak_slots']
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.aks_tmp = set()
self.ak_slots_tmp = set()
def get_details(self):
"""
Get details of this constraint (all fields connected to it)
......@@ -500,8 +505,6 @@ class ConstraintViolation(models.Model):
def timestamp_display(self):
return self.timestamp.astimezone(self.event.timezone).strftime('%d.%m.%y %H:%M')
aks_tmp = set()
@property
def _aks(self):
"""
......@@ -517,8 +520,6 @@ class ConstraintViolation(models.Model):
return set(self.aks.all())
return self.aks_tmp
ak_slots_tmp = set()
@property
def _aks_str(self):
if self.pk and self.pk > 0:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment