Skip to content
Snippets Groups Projects
Commit bbe72e7d authored by Felix Blanke's avatar Felix Blanke
Browse files

Avoid setting the slot duration at import

parent aee5627c
No related branches found
No related tags found
1 merge request!8Avoid setting the slot duration at import
Pipeline #269130 passed
...@@ -401,16 +401,12 @@ class Event(models.Model): ...@@ -401,16 +401,12 @@ class Event(models.Model):
} }
for scheduled_slot in schedule["scheduled_aks"]: for scheduled_slot in schedule["scheduled_aks"]:
slot = AKSlot.objects.get(id=int(scheduled_slot["ak_id"]))
slot.room = Room.objects.get(id=int(scheduled_slot["room_id"]))
scheduled_slot["timeslot_ids"] = list(map(int, scheduled_slot["timeslot_ids"])) scheduled_slot["timeslot_ids"] = list(map(int, scheduled_slot["timeslot_ids"]))
start_timeslot = timeslot_dict[min(scheduled_slot["timeslot_ids"])].avail start_timeslot = timeslot_dict[min(scheduled_slot["timeslot_ids"])].avail
end_timeslot = timeslot_dict[max(scheduled_slot["timeslot_ids"])].avail
slot = AKSlot.objects.get(id=int(scheduled_slot["ak_id"]))
slot.room = Room.objects.get(id=int(scheduled_slot["room_id"]))
slot.start = start_timeslot.start slot.start = start_timeslot.start
slot.duration = (end_timeslot.end - start_timeslot.start).total_seconds() / 3600.0
slot.save() slot.save()
class AKOwner(models.Model): class AKOwner(models.Model):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment