From 58608ea5ff5b7f4d25050c701e841dcaabd04a78 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Fri, 19 Apr 2024 18:51:13 +0200 Subject: [PATCH] Add red background if the defender has at least one penalty Signed-off-by: Emmy D'Anello --- participation/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/participation/models.py b/participation/models.py index 651cd85..c442aca 100644 --- a/participation/models.py +++ b/participation/models.py @@ -1196,6 +1196,9 @@ class Pool(models.Model): (f"C{max_row + 1}:{getcol(2 + passages.count() * passage_width)}{max_row + 3}", (0.9, 0.9, 0.9)), (f"A{max_row + 5}:E{max_row + 5}", (0.8, 0.8, 0.8)), (f"A{max_row + 6}:E{max_row + 5 + pool_size}", (0.9, 0.9, 0.9)),] + # Display penalties in red + bg_colors += [(f"{getcol(2 + (passage.position - 1) * passage_width + 2)}{max_row + 2}", (1.0, 0.7, 0.7)) + for passage in self.passages.filter(defender_penalties__gte=1).all()] for bg_range, bg_color in bg_colors: r, g, b = bg_color format_requests.append({