From 24d9a92a5a625f0d32313ed391d8172ceaf84470 Mon Sep 17 00:00:00 2001 From: Antoine Van Elstraete Date: Wed, 11 Mar 2026 20:32:08 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20carte=20r=C3=A9partition=20par=20type?= =?UTF-8?q?=20de=20jour=20dans=20le=20rapport?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/routes/reports.py | 4 ++++ app/templates/reports.html | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/app/routes/reports.py b/app/routes/reports.py index 9ad956a..f244f3c 100644 --- a/app/routes/reports.py +++ b/app/routes/reports.py @@ -4,6 +4,7 @@ import sqlalchemy as sa from app import db from app.models import WorkEntry from app.business.travel_calc import compute_km_for_entry, compute_co2_grams, compute_frais_reels +from app.business.time_calc import count_day_types from app.config_loader import get_vehicles, get_journeys, get_bareme bp = Blueprint("reports", __name__, url_prefix="/reports") @@ -39,6 +40,8 @@ def index(): electric = vehicle.get("fuel") == "electric" frais_reels[vehicle_id] = round(compute_frais_reels(km, tranches, electric=electric), 2) + day_type_counts = count_day_types(entries) + return render_template( "reports.html", year=year, @@ -46,4 +49,5 @@ def index(): total_co2_kg=round(total_co2 / 1000, 2), frais_reels=frais_reels, vehicles=vehicles, + day_type_counts=day_type_counts, ) diff --git a/app/templates/reports.html b/app/templates/reports.html index 4608369..18525f7 100644 --- a/app/templates/reports.html +++ b/app/templates/reports.html @@ -59,4 +59,23 @@ {% endif %} + +
+

Répartition {{ year }}

+ {% if day_type_counts %} +
+ {% for day_type, count in day_type_counts.items() %} +
+ {{ day_type | day_type_fr }} + + {{ count }}j + +
+ {% endfor %} +
+ {% else %} +

Aucune entrée pour {{ year }}.

+ {% endif %} +
+ {% endblock %}