Files
tableau-de-bord/app/business/time_calc.py

26 lines
570 B
Python

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