feat: time calculation business logic
This commit is contained in:
0
app/business/__init__.py
Normal file
0
app/business/__init__.py
Normal file
25
app/business/time_calc.py
Normal file
25
app/business/time_calc.py
Normal 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
|
||||
Reference in New Issue
Block a user