feat: TOML config loader for vehicles, journeys, and tax scales

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 16:31:13 +01:00
parent 415952f24e
commit 4cbd62882f
4 changed files with 112 additions and 0 deletions

27
app/config_loader.py Normal file
View File

@@ -0,0 +1,27 @@
from flask import current_app
def get_vehicles():
return current_app.config.get("TOML", {}).get("vehicles", {})
def get_journeys():
return current_app.config.get("TOML", {}).get("journeys", {})
def get_bareme(year: int, cv: int) -> list[dict]:
bareme = current_app.config.get("TOML", {}).get("bareme_kilometrique", {})
year_data = bareme.get(str(year), {})
if cv <= 5:
key = "cv_5"
elif cv <= 7:
key = "cv_6_7"
elif cv <= 9:
key = "cv_8_9"
else:
key = "cv_10_11"
return year_data.get(key, {}).get("tranches", [])
def day_types_without_journey():
return {"TT", "MALADE", "CONGE", "RTT", "FERIE"}