Récapitulatif d'astreinte : indique le forfait de chaque jour
Chaque jour d'astreinte déclaré affiche son forfait dans le récapitulatif,
même sans intervention saisie, et les totaux rappellent la somme des
forfaits — sans la mêler aux compteurs pondérés d'astreinte.
💘 Generated with Crush
Assisted-by: Crush:glm-5.2
This commit is contained in:
@ -441,6 +441,7 @@ def compute_week(pointages: list[dict], conges: list[dict], heures_jour_min: int
|
|||||||
as_jours = []
|
as_jours = []
|
||||||
as_total_min = 0
|
as_total_min = 0
|
||||||
as_total_pondere_min = 0
|
as_total_pondere_min = 0
|
||||||
|
as_forfait_min = 0
|
||||||
as_cats: dict[str, dict] = {}
|
as_cats: dict[str, dict] = {}
|
||||||
|
|
||||||
for p in pointages:
|
for p in pointages:
|
||||||
@ -488,8 +489,18 @@ def compute_week(pointages: list[dict], conges: list[dict], heures_jour_min: int
|
|||||||
"retour_min": retour_min,
|
"retour_min": retour_min,
|
||||||
"retour": minutes_to_time(retour_min) if retour_min is not None else None,
|
"retour": minutes_to_time(retour_min) if retour_min is not None else None,
|
||||||
})
|
})
|
||||||
|
# Jours repris dans le récapitulatif d'astreinte : ceux avec des heures
|
||||||
|
# décomptées, mais aussi les jours AS déclarés portant un forfait (sans
|
||||||
|
# intervention) — le forfait y est rappelé, sans entrer dans les compteurs.
|
||||||
|
if (dec and dec["total_min"] > 0) or forfait:
|
||||||
|
as_jours.append({
|
||||||
|
"date": p["date"],
|
||||||
|
"events": dec["events"] if dec else [],
|
||||||
|
"forfait_min": forfait,
|
||||||
|
"forfait_h": minutes_to_hhmm(forfait) if forfait else "",
|
||||||
|
})
|
||||||
|
as_forfait_min += forfait
|
||||||
if dec and dec["total_min"] > 0:
|
if dec and dec["total_min"] > 0:
|
||||||
as_jours.append({"date": p["date"], "events": dec["events"]})
|
|
||||||
as_total_min += dec["total_min"]
|
as_total_min += dec["total_min"]
|
||||||
as_total_pondere_min += dec["total_pondere_min"]
|
as_total_pondere_min += dec["total_pondere_min"]
|
||||||
for c in dec["categories"]:
|
for c in dec["categories"]:
|
||||||
@ -691,11 +702,13 @@ def compute_week(pointages: list[dict], conges: list[dict], heures_jour_min: int
|
|||||||
"moyenne_extra_min": (extra_total // slots_restants) if slots_restants else 0,
|
"moyenne_extra_min": (extra_total // slots_restants) if slots_restants else 0,
|
||||||
"moyenne_extra": minutes_to_hhmm((extra_total // slots_restants) if slots_restants else 0),
|
"moyenne_extra": minutes_to_hhmm((extra_total // slots_restants) if slots_restants else 0),
|
||||||
"astreinte": {
|
"astreinte": {
|
||||||
"actif": as_total_min > 0,
|
"actif": as_total_min > 0 or as_forfait_min > 0,
|
||||||
"total_min": as_total_min,
|
"total_min": as_total_min,
|
||||||
"total_h": minutes_to_hhmm(as_total_min),
|
"total_h": minutes_to_hhmm(as_total_min),
|
||||||
"total_pondere_min": as_total_pondere_min,
|
"total_pondere_min": as_total_pondere_min,
|
||||||
"total_pondere_h": minutes_to_hhmm(as_total_pondere_min),
|
"total_pondere_h": minutes_to_hhmm(as_total_pondere_min),
|
||||||
|
"total_forfait_min": as_forfait_min,
|
||||||
|
"total_forfait_h": minutes_to_hhmm(as_forfait_min),
|
||||||
"categories": as_categories,
|
"categories": as_categories,
|
||||||
"jours": as_jours,
|
"jours": as_jours,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -68,10 +68,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if j.forfait_min %}<div class="as-ev"><span class="as-forfait" title="Forfait du jour AS déclaré (réglé dans Réglages) : ajouté au temps travaillé de la semaine, hors compteurs d'astreinte">forfait + {{ j.forfait_h }}</span></div>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<div class="as-totaux">
|
<div class="as-totaux">
|
||||||
{% for c in result.astreinte.categories %}<span class="as-cat">{{ c.nom }} : {{ c.min_h }} ×{{ c.facteur_txt }} = {{ c.pondere_h }}</span>{% endfor %}
|
{% for c in result.astreinte.categories %}<span class="as-cat">{{ c.nom }} : {{ c.min_h }} ×{{ c.facteur_txt }} = {{ c.pondere_h }}</span>{% endfor %}
|
||||||
|
{% if result.astreinte.total_forfait_min %}<span class="as-forfait" title="Forfaits des jours AS déclarés : ajoutés au temps travaillé, hors compteurs d'astreinte">forfaits + {{ result.astreinte.total_forfait_h }}</span>{% endif %}
|
||||||
<span class="as-grand">total {{ result.astreinte.total_h }} → {{ result.astreinte.total_pondere_h }} pondérées</span>
|
<span class="as-grand">total {{ result.astreinte.total_h }} → {{ result.astreinte.total_pondere_h }} pondérées</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -590,6 +590,7 @@
|
|||||||
border-bottom: 1px dotted var(--rule);
|
border-bottom: 1px dotted var(--rule);
|
||||||
}
|
}
|
||||||
.as-ev-cat, .as-cat { color: var(--accent); font-family: var(--mono); font-size: 11px; }
|
.as-ev-cat, .as-cat { color: var(--accent); font-family: var(--mono); font-size: 11px; }
|
||||||
|
.as-forfait { font-family: var(--mono); color: var(--muted); font-size: 11px; }
|
||||||
.as-ev-pond { font-family: var(--mono); color: var(--accent-2); }
|
.as-ev-pond { font-family: var(--mono); color: var(--accent-2); }
|
||||||
.as-jour-date { font-family: var(--mono); font-weight: 500; margin-right: .4rem; }
|
.as-jour-date { font-family: var(--mono); font-weight: 500; margin-right: .4rem; }
|
||||||
.as-totaux {
|
.as-totaux {
|
||||||
|
|||||||
@ -571,6 +571,14 @@ def test_compute_week_forfait_ajoute_au_travaille_du_jour_declare(freeze_today):
|
|||||||
assert result["jours"][2]["forfait_min"] == 0 # lendemain : rien
|
assert result["jours"][2]["forfait_min"] == 0 # lendemain : rien
|
||||||
assert result["jours"][0]["forfait_min"] == 0 # jour sans astreinte
|
assert result["jours"][0]["forfait_min"] == 0 # jour sans astreinte
|
||||||
assert result["total_travaille"] == "16h36" # 2 × 7h48 + 1h
|
assert result["total_travaille"] == "16h36" # 2 × 7h48 + 1h
|
||||||
|
# récapitulatif d'astreinte : le jour AS apparaît avec son forfait même sans
|
||||||
|
# intervention ; le forfait est rappelé mais hors compteurs pondérés
|
||||||
|
ast = result["astreinte"]
|
||||||
|
assert ast["actif"] is True
|
||||||
|
assert ast["total_min"] == 0
|
||||||
|
assert ast["total_forfait_min"] == 60
|
||||||
|
assert ast["total_forfait_h"] == "1h00"
|
||||||
|
assert [(j["date"], j["forfait_min"], j["events"]) for j in ast["jours"]] == [("2026-07-14", 60, [])]
|
||||||
|
|
||||||
|
|
||||||
def test_compute_week_sans_forfait_comportement_inchange(freeze_today):
|
def test_compute_week_sans_forfait_comportement_inchange(freeze_today):
|
||||||
|
|||||||
Reference in New Issue
Block a user