Skip to content
Snippets Groups Projects
Commit 7a1c5004 authored by Lorenzo Conti's avatar Lorenzo Conti
Browse files

Merge branch 'feature/ak-conflict-dependency' into 'main'

Implement export of AK conflicts and dependencies

See merge request !9
parents bb1179c7 c420f00e
No related branches found
No related tags found
1 merge request!9Implement export of AK conflicts and dependencies
Pipeline #269216 passed
...@@ -953,13 +953,19 @@ class AKSlot(models.Model): ...@@ -953,13 +953,19 @@ class AKSlot(models.Model):
return [] return []
return [f"availability-person-{owner.pk}"] return [f"availability-person-{owner.pk}"]
conflict_slots = AKSlot.objects.filter(ak__in=self.ak.conflicts.all())
dependency_slots = AKSlot.objects.filter(ak__in=self.ak.prerequisites.all())
ceil_offet_eps = decimal.Decimal(1e-4) ceil_offet_eps = decimal.Decimal(1e-4)
# self.slots_in_an_hour is set in AKJSONExportView # self.slots_in_an_hour is set in AKJSONExportView
data = { data = {
"id": str(self.pk), "id": str(self.pk),
"duration": math.ceil(self.duration * self.slots_in_an_hour - ceil_offet_eps), "duration": math.ceil(self.duration * self.slots_in_an_hour - ceil_offet_eps),
"properties": {}, "properties": {
"conflicts": [str(conflict.pk) for conflict in conflict_slots.all()],
"dependencies": [str(dep.pk) for dep in dependency_slots.all()],
},
"room_constraints": [constraint.name "room_constraints": [constraint.name
for constraint in self.ak.requirements.all()], for constraint in self.ak.requirements.all()],
"time_constraints": ["resolution"] if self.ak.reso else [], "time_constraints": ["resolution"] if self.ak.reso else [],
......
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