From bbe72e7d0fa7946635227fb59524d5103e89291f Mon Sep 17 00:00:00 2001
From: Felix Blanke <info@fblanke.de>
Date: Tue, 21 Jan 2025 19:40:16 +0100
Subject: [PATCH] Avoid setting the slot duration at import

---
 AKModel/models.py | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/AKModel/models.py b/AKModel/models.py
index d30912d3..b0460541 100644
--- a/AKModel/models.py
+++ b/AKModel/models.py
@@ -401,16 +401,12 @@ 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
             slot.save()
 
 class AKOwner(models.Model):
-- 
GitLab