fix: Corriger la disparition des créneaux lors d'un déplacement inter-jour
Some checks failed
CI / Backend Tests (push) Has been cancelled
CI / Frontend Tests (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
CI / Naming Conventions (push) Has been cancelled
CI / Build Check (push) Has been cancelled

Lors d'un drag & drop d'un créneau vers un autre jour de la semaine,
le nouveau créneau devenait invisible car recurrenceStart était fixé à
la date d'occurrence (le jour source). Si le jour cible tombait avant
cette date dans la semaine, isActiveOnDate retournait false.

recurrenceStart est maintenant fixé au lundi de la semaine d'occurrence,
ce qui garantit la visibilité du créneau dès la semaine du déplacement.
This commit is contained in:
2026-03-07 00:23:54 +01:00
parent 39f8650b92
commit 125d9d8806
2 changed files with 44 additions and 3 deletions

View File

@@ -117,7 +117,12 @@ final readonly class UpdateRecurringSlotHandler
$slot->terminerRecurrenceLe($dayBefore, $now);
$this->slotRepository->save($slot);
// Create new slot starting from the occurrence date
// Use the Monday of the occurrence week as recurrenceStart so the new slot
// is visible in the current week even when moved to an earlier day-of-week.
$dayN = (int) $occurrenceDate->format('N');
$weekMonday = $occurrenceDate->modify('-' . ($dayN - 1) . ' days');
// Create new slot starting from the Monday of the occurrence week
$newSlot = ScheduleSlot::creer(
tenantId: $tenantId,
classId: ClassId::fromString($command->classId),
@@ -128,7 +133,7 @@ final readonly class UpdateRecurringSlotHandler
room: $command->room,
isRecurring: true,
now: $now,
recurrenceStart: $occurrenceDate,
recurrenceStart: $weekMonday,
recurrenceEnd: $originalRecurrenceEnd,
);