fix(hr): ensure positive workedHours and robust HD detection

This commit is contained in:
2026-04-28 18:13:13 +08:00
parent c5bf5d8d79
commit 29ce088592

View File

@@ -915,7 +915,10 @@ class AttendanceRecordController extends Controller
if ($out->lt($in)) {
$out->addDay();
}
$workedHours = $out->diffInMinutes($in) / 60;
$workedHours = (float)abs($out->diffInMinutes($in) / 60);
} else {
// Fallback to record's total hours if available
$workedHours = (float)($record->total_hours ?? 0);
}
$recordDetail = [