From 0f312eb8823f507512ffed0408b4a4e0706c8eeb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Sat, 20 Apr 2024 19:01:28 +0200
Subject: [PATCH] Only check room size if interest > -1

This prevents warning for AKs where interest was not specified and room capacity is quite small.
This resolves #209
---
 AKScheduling/models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/AKScheduling/models.py b/AKScheduling/models.py
index 769527f7..1495f311 100644
--- a/AKScheduling/models.py
+++ b/AKScheduling/models.py
@@ -80,8 +80,8 @@ def check_capacity_for_slot(slot: AKSlot):
     :rtype: ConstraintViolation or None
     """
 
-    # If slot is scheduled in a room
-    if slot.room and slot.room.capacity >= 0:
+    # If slot is scheduled in a room and interest was specified
+    if slot.room and slot.room.capacity >= 0 and slot.ak.interest >= 0:
         # Create a violation if interest exceeds room capacity
         if slot.room.capacity < slot.ak.interest:
             c = ConstraintViolation(
-- 
GitLab