Fix attendance punch duration timezone handling
This commit is contained in:
@@ -896,7 +896,13 @@ def _evaluate_attendance_timing(branch: Branch | None, settings: BranchSettings
|
|||||||
def _attendance_duration_minutes(row: EmployeeAttendance) -> int | None:
|
def _attendance_duration_minutes(row: EmployeeAttendance) -> int | None:
|
||||||
if not row.punch_in_utc or not row.punch_out_utc:
|
if not row.punch_in_utc or not row.punch_out_utc:
|
||||||
return None
|
return None
|
||||||
delta = row.punch_out_utc - row.punch_in_utc
|
|
||||||
|
punch_in_utc = _as_utc_aware(row.punch_in_utc)
|
||||||
|
punch_out_utc = _as_utc_aware(row.punch_out_utc)
|
||||||
|
if not punch_in_utc or not punch_out_utc:
|
||||||
|
return None
|
||||||
|
|
||||||
|
delta = punch_out_utc - punch_in_utc
|
||||||
minutes = int(delta.total_seconds() // 60)
|
minutes = int(delta.total_seconds() // 60)
|
||||||
return max(minutes, 0)
|
return max(minutes, 0)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user