From 01085ec53cbcf9c3cce9a674f3d4462bc25d4b8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Benjamin=20H=C3=A4ttasch?=
 <benjamin.haettasch@fachschaft.informatik.tu-darmstadt.de>
Date: Thu, 13 May 2021 02:36:31 +0200
Subject: [PATCH] Visualize constraint violations in scheduler

---
 AKScheduling/api.py                                       | 2 +-
 AKScheduling/templates/admin/AKScheduling/scheduling.html | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/AKScheduling/api.py b/AKScheduling/api.py
index af73c791..b7ab7fbd 100644
--- a/AKScheduling/api.py
+++ b/AKScheduling/api.py
@@ -48,7 +48,7 @@ class EventsView(LoginRequiredMixin, EventSlugMixin, ListView):
                 "start": timezone.localtime(slot.start, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"),
                 "end": timezone.localtime(slot.end, self.event.timezone).strftime("%Y-%m-%d %H:%M:%S"),
                 "backgroundColor": slot.ak.category.color,
-                "borderColor": "#ff291d" if slot.fixed else slot.ak.category.color,
+                "borderColor": "#2c3e50" if slot.fixed else '#e74c3c' if slot.constraintviolation_set.count() > 0 else slot.ak.category.color,
                 "constraint": 'roomAvailable',
                 "editable": not slot.fixed,
                 'url': str(reverse('admin:AKModel_akslot_change', args=[slot.pk])),
diff --git a/AKScheduling/templates/admin/AKScheduling/scheduling.html b/AKScheduling/templates/admin/AKScheduling/scheduling.html
index daa19367..9a140a4c 100644
--- a/AKScheduling/templates/admin/AKScheduling/scheduling.html
+++ b/AKScheduling/templates/admin/AKScheduling/scheduling.html
@@ -22,6 +22,10 @@
         .fc-v-event, .tooltip {
             white-space: pre-line;
         }
+
+        .fc-v-event {
+            border-width: 4px;
+        }
     </style>
 
     <script>
-- 
GitLab