Edit task creation start time

This commit is contained in:
2026-07-25 11:34:23 +03:30
parent 49c9a45e82
commit 2c811c0d8c
3 changed files with 39 additions and 24 deletions
+4 -3
View File
@@ -28,8 +28,9 @@ class LatePenaltyService
];
}
$entered = Carbon::parse($enteredAt);
$threshold = $entered->copy()->setTimeFromTimeString(self::WORK_START);
// فقط تا دقیقه؛ ثانیه نادیده گرفته می‌شود
$entered = Carbon::parse($enteredAt)->startOfMinute();
$threshold = $entered->copy()->setTimeFromTimeString(self::WORK_START)->startOfMinute();
if ($entered->lte($threshold)) {
return [
@@ -40,7 +41,7 @@ class LatePenaltyService
];
}
$lateMinutes = (int) ceil($threshold->diffInSeconds($entered) / 60);
$lateMinutes = (int) $threshold->diffInMinutes($entered);
// تأخیر داخل بازه ارفاق روزانه (۸:۳۰ تا ۸:۴۵) — مبنای جریمه هفتگی
$graceLateMinutes = min($lateMinutes, self::DAILY_GRACE_MINUTES);
$dailyFineMinutes = max(0, $lateMinutes - self::DAILY_GRACE_MINUTES);