fix(rtt) : do not cap periodFrom at phase.startDate

The RTT week table was hiding all weeks before the phase's startDate,
so for an employee hired mid-exercise (e.g. Dylan CHABOISSON, CDD
starting 2026-03-19) March displayed only from week 12 instead of
week 9, with no visible padding for the pre-hire weeks of the exercise.

Mirrors the same fix applied to the leave provider: the exercise unit
for RTT is annual (Juin→Mai). Capping periodFrom artificially clipped
the displayed weeks. Days without a contract naturally contribute 0
minutes (no reference, no worked hours), so the cumul is correct
without the cap.

periodTo and limitDate caps at phase.endDate are preserved for closed
phases so the table doesn't extend past the phase end.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-19 15:08:29 +02:00
parent 54d9a30f71
commit 653845655f
3 changed files with 9 additions and 6 deletions

View File

@@ -75,13 +75,16 @@ final readonly class EmployeeRttSummaryProvider implements ProviderInterface
$currentExerciseYear = $this->resolveCurrentExerciseYear($today);
[$periodFrom, $periodTo] = $this->rttRecoveryService->resolveExerciseBounds($year);
// Cap exercise bounds to the phase boundaries.
// Cap periodTo at the phase endDate for closed phases so the RTT table does
// not extend past the date the phase ended.
// Do NOT cap periodFrom at phase.startDate: keep the full exercise
// displayed so weeks before the employee's hire (or before a past phase
// started) appear at 0, matching the previous behavior. Weeks outside the
// contract range contribute 0 minutes to the cumul naturally (no contract
// ⇒ no reference, no worked hours).
if (!$phase->isCurrent && null !== $phase->endDate && $phase->endDate < $periodTo) {
$periodTo = $phase->endDate;
}
if ($phase->startDate > $periodFrom) {
$periodFrom = $phase->startDate;
}
$weeks = $this->rttRecoveryService->buildWeeksForExercise($periodFrom, $periodTo);
$weekRanges = array_map(