feat: work shift pauses

This commit is contained in:
2024-12-04 11:00:00 +04:00
parent 2bd2486653
commit 9a6fc3fdd7
5 changed files with 316 additions and 72 deletions

View File

@@ -1,7 +1,13 @@
from datetime import timedelta
from math import floor
def hours_to_hours_and_minutes(hours: float) -> tuple[int, int]:
def hours_to_hours_and_minutes(time: timedelta) -> tuple[int, int]:
if time.total_seconds() < 60:
return 0, 0
hours = time.total_seconds() / 3600
res_hours = int(floor(hours))
minutes = int(round((hours - res_hours) * 60))
minutes = int(floor((hours - res_hours) * 60))
return res_hours, minutes