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

Merge branch 'feature/multiple-ak-occurrence' into 'main'

AKs with multiple slots in JSON export

See merge request !10
parents e7862fee b0f0b9ae
Branches
No related tags found
2 merge requests!17Add view to clear schedule,!10AKs with multiple slots in JSON export
Pipeline #271284 passed
......@@ -957,6 +957,7 @@ 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)
......@@ -965,7 +966,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
......@@ -978,6 +981,7 @@ class AKSlot(models.Model):
"description": self.ak.description,
"reso": self.ak.reso,
"duration_in_hours": float(self.duration),
"django_ak_id": str(self.ak.pk),
},
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment