From 1b4bf0d4888ce39fef9c3b5cf91356252476d2e4 Mon Sep 17 00:00:00 2001 From: Jacquin Antoine Date: Fri, 11 Sep 2026 15:45:00 +0200 Subject: [PATCH] =?UTF-8?q?Forfait=20d'astreinte=20:=20facteur=20journ?= =?UTF-8?q?=C3=A9e=20affich=C3=A9,=20plus=20de=20fl=C3=A8che=20fant=C3=B4m?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit La pondération des forfaits suit le facteur journée du jour AS (semaine ×1, samedi ×1,5, dimanche/férié ×2) : sur des jours de semaine elle ne change rien, et le récapitulatif affichait « 0h45 → 0h45 pondérés » — comme si la pondération n'était jamais appliquée. Le facteur est désormais toujours visible par jour (« forfait 0h15 ×1 »), et la flèche n'apparaît que quand la bonification change réellement le total (« ×1 (jours de semaine) » sinon). 💘 Generated with Crush Assisted-by: Crush:glm-5.2 --- app/templates/_soldes.html | 6 +++--- app/tests/test_ui_refonte.py | 23 ++++++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/templates/_soldes.html b/app/templates/_soldes.html index 9fc2f03..6ecce2d 100644 --- a/app/templates/_soldes.html +++ b/app/templates/_soldes.html @@ -91,7 +91,7 @@
{{ j.jour }} {{ j.date[8:] }}/{{ j.date[5:7] }} - {% if j.forfait_min %}forfait {{ j.forfait_h }}{% if j.forfait_pondere_min != j.forfait_min %} → {{ j.forfait_pondere_h }} pondérées{% endif %}{% endif %} + {% if j.forfait_min %}forfait {{ j.forfait_h }} ×{{ j.forfait_facteur_txt }}{% if j.forfait_pondere_min != j.forfait_min %} → {{ j.forfait_pondere_h }} pondérées{% endif %}{% endif %} {% if j.total_min %}astreinte {{ j.total_h }} → {{ j.total_pondere_h }} pondérées{% endif %}
{% for ev in j.events %} @@ -111,8 +111,8 @@ {% endfor %}
{% for c in result.astreinte.categories %}{{ c.nom }} : {{ c.min_h }} ×{{ c.facteur_txt }} = {{ c.pondere_h }}{% endfor %} - {% if result.astreinte.total_forfait_min %}forfaits {{ result.astreinte.total_forfait_h }} → {{ result.astreinte.total_forfait_pondere_h }} pondérés (hors heures travaillées){% endif %} - total {{ result.astreinte.total_h }} → {{ result.astreinte.total_pondere_h }} pondérées{% if result.astreinte.total_forfait_pondere_min %} (+ {{ result.astreinte.total_forfait_pondere_h }} de forfaits pondérés){% endif %} + {% if result.astreinte.total_forfait_min %}forfaits {{ result.astreinte.total_forfait_h }}{% if result.astreinte.total_forfait_pondere_min != result.astreinte.total_forfait_min %} → {{ result.astreinte.total_forfait_pondere_h }} pondérés{% else %} ×1 (jours de semaine){% endif %} (hors heures travaillées){% endif %} + total {{ result.astreinte.total_h }} → {{ result.astreinte.total_pondere_h }} pondérées{% if result.astreinte.total_forfait_pondere_min %}{% if result.astreinte.total_forfait_pondere_min != result.astreinte.total_forfait_min %} (+ {{ result.astreinte.total_forfait_pondere_h }} de forfaits pondérés){% else %} (+ {{ result.astreinte.total_forfait_h }} de forfaits ×1){% endif %}{% endif %}
{% endif %} diff --git a/app/tests/test_ui_refonte.py b/app/tests/test_ui_refonte.py index d39d983..e349a2b 100644 --- a/app/tests/test_ui_refonte.py +++ b/app/tests/test_ui_refonte.py @@ -110,10 +110,31 @@ def test_forfait_bonifie_journee_affiche_dans_le_recap(monkeypatch): r = client.get("/semaine/2026/29", cookies=cookies, follow_redirects=False) assert r.status_code == 200, r.text - assert "forfait 1h00 → 1h30 pondérées" in r.text # ligne du jour (bloc AS) + assert "forfait 1h00 ×1,5 → 1h30 pondérées" in r.text # ligne du jour (bloc AS) assert "forfaits 1h00 → 1h30 pondérés" in r.text # totaux du récapitulatif assert "considéré réalisé en journée" in r.text # explication au survol + +def test_forfait_semaine_affiche_le_facteur_1_sans_ponderation_fantome(monkeypatch): + """Forfait sur des jours AS de semaine : le facteur journée vaut ×1, la + pondération ne change donc rien. L'affichage doit le dire explicitement + (« forfait 0h15 ×1 », « forfaits 0h45 ×1 (jours de semaine) ») au lieu + d'une flèche « → pondérés » qui suggère une pondération jamais appliquée.""" + monkeypatch.setattr(main, "datetime", _FrozenDatetime) + cookies = _login("u-ui-forfait-x1") + r = client.post("/settings/astreinte-forfait", cookies=cookies, + data={"astreinte_forfait": "00:15"}, follow_redirects=False) + assert r.status_code == 303, r.text + for d in ("2026-07-13", "2026-07-15", "2026-07-16"): # lun, mer, jeu (mardi 14/07 = férié ×2) + client.post(f"/astreinte/{d}/toggle", cookies=cookies, follow_redirects=False) + + r = client.get("/semaine/2026/29", cookies=cookies, follow_redirects=False) + assert r.status_code == 200, r.text + assert r.text.count("forfait 0h15 ×1") == 3 # lun, mar, mer : facteur visible + assert "forfaits 0h45 ×1 (jours de semaine)" in r.text # totaux : pas de flèche fantôme + assert "(+ 0h45 de forfaits ×1)" in r.text # grand total idem + assert "forfaits 0h45 →" not in r.text # aucune pondération affichée à tort + def test_refresh_regenerere_les_cibles_en_fonction_de_lheure(monkeypatch): """Le poll /refresh (toutes les 30 s, et au retour sur l'onglet) régénère les cibles OOB avec l'heure courante : à 14:12, l'après-midi non commencé