feat: enforce time rounding down to the nearest 30 mins for total_hours
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user