From c6501f33b8f83e2057d1d7ccd185ea763f0d70c2 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 20 Aug 2026 20:54:52 +0000 Subject: [PATCH] =?UTF-8?q?Afficher=20uniquement=20les=20=C3=A9carts=20hor?= =?UTF-8?q?aires?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app_new/planning/schedules.py | 8 ++++++++ app_new/templates/planning/calendar.html | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app_new/planning/schedules.py b/app_new/planning/schedules.py index 7e2a487..445754a 100644 --- a/app_new/planning/schedules.py +++ b/app_new/planning/schedules.py @@ -162,6 +162,12 @@ def index(): entry = time_entries.get(d) actual_minutes = entry.actual_minutes if entry else 0 fmt = lambda minutes: f"{minutes // 60}h{minutes % 60:02d}" + deviation_hours = None + deviation_class = None + if entry and entry.entry_type == 'retard' and actual_minutes: + deviation_hours, deviation_class = f"-{fmt(actual_minutes)}", 'text-danger' + elif entry and entry.entry_type == 'supplementaire' and actual_minutes: + deviation_hours, deviation_class = f"+{fmt(actual_minutes)}", 'text-success' week.append({ 'day': day, @@ -175,6 +181,8 @@ def index(): 'leave_type': 'congé' if leave else None, 'worked_hours': fmt(actual_minutes), 'planned_hours': fmt(planned_minutes), + 'deviation_hours': deviation_hours, + 'deviation_class': deviation_class, 'events': events_by_date.get(d, []), }) diff --git a/app_new/templates/planning/calendar.html b/app_new/templates/planning/calendar.html index 6308f74..61279c7 100644 --- a/app_new/templates/planning/calendar.html +++ b/app_new/templates/planning/calendar.html @@ -118,7 +118,7 @@ title="{{ day_info.vacation_name if day_info.vacation_name else '' }}"> {{ day_info.day }} - {{ day_info.worked_hours }} / {{ day_info.planned_hours }} + {% if day_info.deviation_hours %}{{ day_info.deviation_hours }}{% endif %} {% if day_info.events %}
{% for event in day_info.events[:3] %}