feat: time calculation business logic

This commit is contained in:
2026-03-11 16:39:39 +01:00
parent 1e3f5bb0c7
commit 7babe05412
3 changed files with 67 additions and 0 deletions

25
app/business/time_calc.py Normal file
View File

@@ -0,0 +1,25 @@
def minutes_to_str(minutes: int) -> str:
sign = "-" if minutes < 0 else ""
minutes = abs(minutes)
return f"{sign}{minutes // 60}h{minutes % 60:02d}"
_REFERENCE_MINUTES = {
"WORK": 465,
"TT": 465,
"FORMATION": 465,
"GARDE": 600,
"ASTREINTE": 0,
"RTT": 0,
"CONGE": 0,
"MALADE": 0,
"FERIE": 0,
}
def work_minutes_reference(day_type: str) -> int:
return _REFERENCE_MINUTES.get(day_type, 465)
def week_balance_minutes(actual_minutes: int, reference_minutes: int) -> int:
return actual_minutes - reference_minutes