diff --git a/app/Models/AttendanceRecord.php b/app/Models/AttendanceRecord.php index d19ee0bee..5894e9b21 100644 --- a/app/Models/AttendanceRecord.php +++ b/app/Models/AttendanceRecord.php @@ -150,7 +150,11 @@ class AttendanceRecord extends BaseModel } $workingMinutes = max(0, $totalMinutes - $breakMinutes); - $calculatedHours = round($workingMinutes / 60, 2); + + // Round DOWN to the nearest 30 minutes (0.5 hours) + // e.g. 6.28 hours becomes 6.0 hours, 6.75 hours becomes 6.5 hours + $rawHours = $workingMinutes / 60; + $calculatedHours = floor($rawHours * 2) / 2; $this->attributes['total_hours'] = $calculatedHours; $this->attributes['break_hours'] = round($breakMinutes / 60, 2);