Skip to content
Snippets Groups Projects

Avoid setting the slot duration at import

Merged Felix Blanke requested to merge feature/avoid-duration-setting-at-import into main
All threads resolved!
+ 6
5
@@ -401,16 +401,17 @@ class Event(models.Model):
}
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"]))
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.duration = (end_timeslot.end - start_timeslot.start).total_seconds() / 3600.0
solver_duration = (end_timeslot.end - start_timeslot.start).total_seconds() / 3600.0
assert solver_duration + 1e-4 >= slot.duration
slot.save()
class AKOwner(models.Model):
Loading