Afficher uniquement les écarts horaires
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run

This commit is contained in:
root 2026-08-20 20:54:52 +00:00
parent 923f3a31a5
commit c6501f33b8
2 changed files with 9 additions and 1 deletions

View file

@ -162,6 +162,12 @@ def index():
entry = time_entries.get(d) entry = time_entries.get(d)
actual_minutes = entry.actual_minutes if entry else 0 actual_minutes = entry.actual_minutes if entry else 0
fmt = lambda minutes: f"{minutes // 60}h{minutes % 60:02d}" 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({ week.append({
'day': day, 'day': day,
@ -175,6 +181,8 @@ def index():
'leave_type': 'congé' if leave else None, 'leave_type': 'congé' if leave else None,
'worked_hours': fmt(actual_minutes), 'worked_hours': fmt(actual_minutes),
'planned_hours': fmt(planned_minutes), 'planned_hours': fmt(planned_minutes),
'deviation_hours': deviation_hours,
'deviation_class': deviation_class,
'events': events_by_date.get(d, []), 'events': events_by_date.get(d, []),
}) })

View file

@ -118,7 +118,7 @@
title="{{ day_info.vacation_name if day_info.vacation_name else '' }}"> title="{{ day_info.vacation_name if day_info.vacation_name else '' }}">
{{ day_info.day }} {{ day_info.day }}
</a> </a>
<small class="d-block text-nowrap {% if td_class == 'table-dark' %}text-white{% endif %}" title="Heures réalisées / prévues">{{ day_info.worked_hours }} / {{ day_info.planned_hours }}</small> {% if day_info.deviation_hours %}<small class="d-block text-nowrap fw-bold {{ day_info.deviation_class }}" title="Écart de la journée">{{ day_info.deviation_hours }}</small>{% endif %}
{% if day_info.events %} {% if day_info.events %}
<div class="mt-1 d-flex flex-column gap-1"> <div class="mt-1 d-flex flex-column gap-1">
{% for event in day_info.events[:3] %} {% for event in day_info.events[:3] %}