chore: fix python style violations
Co-authored-by: OpenAI/GPT-5.6-Terra <vibecoder@antoineve.me> Co-authored-by: OpenAI/GPT-5.6-Luna <vibecoder@antoineve.me> Co-authored-by: MiniMax/MiniMax-M3 <vibecoder@antoineve.me> Co-authored-by: DeepSeek/DeepSeek-v4-Flash <vibecoder@antoineve.me>
This commit is contained in:
@@ -1,34 +1,40 @@
|
||||
from app import db
|
||||
from app.models import WorkEntry, LeaveBalance
|
||||
import sqlalchemy as sa
|
||||
from datetime import date
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from app import db
|
||||
from app.models import LeaveBalance, WorkEntry
|
||||
|
||||
|
||||
def compute_leave_used(year: int) -> dict[str, int]:
|
||||
start = date(year, 1, 1)
|
||||
end = date(year, 12, 31)
|
||||
|
||||
conges = db.session.scalar(
|
||||
sa.select(sa.func.count()).where(
|
||||
WorkEntry.date.between(start, end),
|
||||
WorkEntry.day_type == "CONGE",
|
||||
conges = (
|
||||
db.session.scalar(
|
||||
sa.select(sa.func.count()).where(
|
||||
WorkEntry.date.between(start, end),
|
||||
WorkEntry.day_type == "CONGE",
|
||||
)
|
||||
)
|
||||
) or 0
|
||||
or 0
|
||||
)
|
||||
|
||||
rtt = db.session.scalar(
|
||||
sa.select(sa.func.count()).where(
|
||||
WorkEntry.date.between(start, end),
|
||||
WorkEntry.day_type == "RTT",
|
||||
rtt = (
|
||||
db.session.scalar(
|
||||
sa.select(sa.func.count()).where(
|
||||
WorkEntry.date.between(start, end),
|
||||
WorkEntry.day_type == "RTT",
|
||||
)
|
||||
)
|
||||
) or 0
|
||||
or 0
|
||||
)
|
||||
|
||||
return {"conges": conges, "rtt": rtt}
|
||||
|
||||
|
||||
def get_or_create_balance(year: int) -> LeaveBalance:
|
||||
balance = db.session.scalar(
|
||||
sa.select(LeaveBalance).where(LeaveBalance.year == year)
|
||||
)
|
||||
balance = db.session.scalar(sa.select(LeaveBalance).where(LeaveBalance.year == year))
|
||||
if balance is None:
|
||||
balance = LeaveBalance(year=year)
|
||||
db.session.add(balance)
|
||||
|
||||
@@ -32,7 +32,9 @@ def compute_co2_grams(km_by_vehicle: dict[str, int], vehicles: dict) -> float:
|
||||
return total
|
||||
|
||||
|
||||
def compute_frais_reels(total_km_moteur: float, tranches: list[dict], electric: bool = False) -> float:
|
||||
def compute_frais_reels(
|
||||
total_km_moteur: float, tranches: list[dict], electric: bool = False
|
||||
) -> float:
|
||||
"""
|
||||
Calcule les frais réels fiscaux selon le barème kilométrique.
|
||||
km_max = 0 signifie "pas de limite" (dernière tranche).
|
||||
|
||||
Reference in New Issue
Block a user