diff --git a/backend/destinations.py b/backend/destinations.py index 8242561..1b40830 100644 --- a/backend/destinations.py +++ b/backend/destinations.py @@ -223,10 +223,10 @@ def reset_compteur(): # --- Suivi consommables --- -TAILLE_RUBAN = { - "15x20": 1.0, - "10x15": 0.667, +RATIO_RUBAN_OPTIMAL = { + "10x15": 0.5, "10x15-2up": 1.0, + "15x20": 1.0, "15x20-2up": 1.0, } @@ -241,11 +241,17 @@ def maj_consommables(config: dict, copies: int, format_papier: str | None): conso["papier_utilise"] = conso.get("papier_utilise", 0) + feuilles conso["photos_imprimees"] = conso.get("photos_imprimees", 0) + copies + ratio_optimal = RATIO_RUBAN_OPTIMAL.get(fmt, 1.0) if rembobinage: - ruban_par_feuille = TAILLE_RUBAN.get(fmt, 1.0) + ruban_consomme = feuilles * ratio_optimal else: - ruban_par_feuille = 1.0 - conso["ruban_utilise"] = round(conso.get("ruban_utilise", 0) + feuilles * ruban_par_feuille, 1) + ruban_consomme = feuilles * 1.0 + + conso["ruban_utilise"] = round(conso.get("ruban_utilise", 0) + ruban_consomme, 1) + + # Poses perdues = ruban avance inutilement (difference entre consomme et optimal) + poses_perdues = feuilles * 1.0 - feuilles * ratio_optimal if not rembobinage else 0 + conso["poses_perdues"] = round(conso.get("poses_perdues", 0) + poses_perdues, 1) mettre_a_jour_config({"consommables": conso}) @@ -259,6 +265,7 @@ def consommables_etat() -> dict: papier_used = conso.get("papier_utilise", 0) ruban_used = conso.get("ruban_utilise", 0) photos = conso.get("photos_imprimees", 0) + perdues = conso.get("poses_perdues", 0) return { "papier_capacite": papier_cap, "papier_utilise": papier_used, @@ -267,6 +274,7 @@ def consommables_etat() -> dict: "ruban_utilise": ruban_used, "ruban_restant": max(0, round(ruban_cap - ruban_used, 1)), "photos_imprimees": photos, + "poses_perdues": perdues, } @@ -278,6 +286,8 @@ def reset_consommables(quoi: str): conso["papier_utilise"] = 0 if quoi in ("ruban", "tout"): conso["ruban_utilise"] = 0 + conso["poses_perdues"] = 0 if quoi == "tout": conso["photos_imprimees"] = 0 + conso["poses_perdues"] = 0 mettre_a_jour_config({"consommables": conso}) diff --git a/frontend/css/style.css b/frontend/css/style.css index c8a517b..1c53dd4 100644 --- a/frontend/css/style.css +++ b/frontend/css/style.css @@ -937,7 +937,7 @@ html, body { .conso-grid { display: grid; - grid-template-columns: repeat(3, 1fr); + grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; } diff --git a/frontend/index.html b/frontend/index.html index 376a9b6..c638b11 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -502,6 +502,12 @@