diff --git a/src/Service/Rtt/RttRecoveryComputationService.php b/src/Service/Rtt/RttRecoveryComputationService.php index 37a56aa..ebd4b5b 100644 --- a/src/Service/Rtt/RttRecoveryComputationService.php +++ b/src/Service/Rtt/RttRecoveryComputationService.php @@ -413,10 +413,17 @@ final readonly class RttRecoveryComputationService { $total = 0; foreach ($days as $date) { - $isoDay = (int) new DateTimeImmutable($date)->format('N'); - $contract = $contractsByDate[$date] ?? null; - $hours = $contract?->getWeeklyHours(); - $startHours = (null !== $hours && $hours >= 39) ? 39 : 35; + $isoDay = (int) new DateTimeImmutable($date)->format('N'); + $contract = $contractsByDate[$date] ?? null; + $hours = $contract?->getWeeklyHours(); + // Days without an active contract (pre-hire, post-termination, contract + // gaps) must NOT contribute to the weekly 25% overtime threshold — + // otherwise hiring mid-week artificially inflates the threshold and + // erases legitimate overtime. + if (null === $hours || $hours <= 0) { + continue; + } + $startHours = $hours >= 39 ? 39 : 35; $total += $this->resolveDailyReferenceMinutes($startHours, $isoDay); }