Skip to content
Snippets Groups Projects
Commit a43b0207 authored by Benjamin Hättasch's avatar Benjamin Hättasch
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 3b2164e8
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): ...@@ -465,6 +465,11 @@ class ConstraintViolation(models.Model):
fields = ['ak_owner', 'room', 'requirement', 'category'] fields = ['ak_owner', 'room', 'requirement', 'category']
fields_mm = ['_aks', '_ak_slots'] 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): def get_details(self):
""" """
Get details of this constraint (all fields connected to it) Get details of this constraint (all fields connected to it)
...@@ -500,8 +505,6 @@ class ConstraintViolation(models.Model): ...@@ -500,8 +505,6 @@ class ConstraintViolation(models.Model):
def timestamp_display(self): def timestamp_display(self):
return self.timestamp.astimezone(self.event.timezone).strftime('%d.%m.%y %H:%M') return self.timestamp.astimezone(self.event.timezone).strftime('%d.%m.%y %H:%M')
aks_tmp = set()
@property @property
def _aks(self): def _aks(self):
""" """
...@@ -517,8 +520,6 @@ class ConstraintViolation(models.Model): ...@@ -517,8 +520,6 @@ class ConstraintViolation(models.Model):
return set(self.aks.all()) return set(self.aks.all())
return self.aks_tmp return self.aks_tmp
ak_slots_tmp = set()
@property @property
def _aks_str(self): def _aks_str(self):
if self.pk and self.pk > 0: 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