From 27bcd7a0b4b0fe1946cff9d5771d59c020831eff Mon Sep 17 00:00:00 2001 From: Jacquin Antoine Date: Sun, 19 Jul 2026 23:25:16 +0200 Subject: [PATCH] =?UTF-8?q?Affiche=20l'heure=20d'arriv=C3=A9e=20en=20plus?= =?UTF-8?q?=20du=20d=C3=A9part=20dans=20les=20pr=C3=A9conisations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La colonne "Cible" (anciennement "Fin cible") montre désormais une plage complète entrée → sortie pour chaque demi-journée à rattraper, au lieu d'une heure de départ seule. Moins ambigu pour l'utilisateur qui sait aussi quand arriver. 💘 Generated with Crush Assisted-by: Crush:glm-5.2 --- app/calcul.py | 12 ++++++++++-- app/main.py | 4 ++-- app/templates/_ligne.html | 4 ++-- app/templates/semaine.html | 2 +- app/tests/test_calcul.py | 2 ++ 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/calcul.py b/app/calcul.py index 66d2476..5df373d 100644 --- a/app/calcul.py +++ b/app/calcul.py @@ -131,6 +131,8 @@ def compute_week(pointages: list[dict], conges: list[dict], heures_jour_min: int for jour in jours: jour["cible_matin"] = None jour["cible_aprem"] = None + jour["cible_matin_entree"] = None + jour["cible_aprem_entree"] = None restant = total_du - total_travaille @@ -204,8 +206,14 @@ def compute_week(pointages: list[dict], conges: list[dict], heures_jour_min: int continue # rythme normal suffit pour cette demi-journée, rien à signaler sortie_min = s["debut"] + s["nominal"] + adjs[i] sortie_min = max(sortie_min, matin_fin_min if s["half"] == "matin" else aprem_fin_min) - cible = f"{sortie_min // 60:02d}:{sortie_min % 60:02d}" - s["jour"]["cible_matin" if s["half"] == "matin" else "cible_aprem"] = cible + entree = f"{s['debut'] // 60:02d}:{s['debut'] % 60:02d}" + sortie = f"{sortie_min // 60:02d}:{sortie_min % 60:02d}" + if s["half"] == "matin": + s["jour"]["cible_matin_entree"] = entree + s["jour"]["cible_matin"] = sortie + else: + s["jour"]["cible_aprem_entree"] = entree + s["jour"]["cible_aprem"] = sortie reste_min = max(0, restant) diff --git a/app/main.py b/app/main.py index ae4757f..7e7b2d1 100644 --- a/app/main.py +++ b/app/main.py @@ -166,9 +166,9 @@ def _oob_week_extras(result): html += f'{cumul_inner}' parts = [] if jour.get("cible_matin"): - parts.append(f'M {jour["cible_matin"]}') + parts.append(f'M {jour["cible_matin_entree"]} → {jour["cible_matin"]}') if jour.get("cible_aprem"): - parts.append(f'A {jour["cible_aprem"]}') + parts.append(f'A {jour["cible_aprem_entree"]} → {jour["cible_aprem"]}') cible_inner = " ".join(parts) if parts else '' html += f'{cible_inner}' return html diff --git a/app/templates/_ligne.html b/app/templates/_ligne.html index f444f52..73b399d 100644 --- a/app/templates/_ligne.html +++ b/app/templates/_ligne.html @@ -70,9 +70,9 @@ {%- if j.cible_matin or j.cible_aprem -%} - {%- if j.cible_matin -%}M {{ j.cible_matin }}{%- endif -%} + {%- if j.cible_matin -%}M {{ j.cible_matin_entree }} → {{ j.cible_matin }}{%- endif -%} {%- if j.cible_matin and j.cible_aprem %} {% endif -%} - {%- if j.cible_aprem -%}A {{ j.cible_aprem }}{%- endif -%} + {%- if j.cible_aprem -%}A {{ j.cible_aprem_entree }} → {{ j.cible_aprem }}{%- endif -%} {%- else -%} {%- endif %} diff --git a/app/templates/semaine.html b/app/templates/semaine.html index 478e7b3..a498306 100644 --- a/app/templates/semaine.html +++ b/app/templates/semaine.html @@ -53,7 +53,7 @@ Travaillé Δ jour Δ sem. - Fin cible + Cible Congé diff --git a/app/tests/test_calcul.py b/app/tests/test_calcul.py index 726dab9..19909d9 100644 --- a/app/tests/test_calcul.py +++ b/app/tests/test_calcul.py @@ -113,6 +113,8 @@ def test_compute_week_cible_repartie_sur_seule_demi_journee_restante(freeze_toda assert vendredi["cible_matin"] is None # matin déjà pointé (entrée+sortie), plus rien à y faire assert vendredi["cible_aprem"] == "18:18" + # La préconisation aprem inclut aussi l'heure d'arrivée (reprise par défaut 13:30) + assert vendredi["cible_aprem_entree"] == "13:30" def test_compute_week_semaine_totalement_vide_compte_les_10_demi_journees(freeze_today):