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:
27
app/config_loader.py
Normal file
27
app/config_loader.py
Normal 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"}
|
||||
Reference in New Issue
Block a user