From 085fe0c15055fff215c5421130cb41d5ec2526bd Mon Sep 17 00:00:00 2001 From: tristan Date: Fri, 20 Mar 2026 14:42:36 +0100 Subject: [PATCH] fix : calcule des RTT pour les chauffeurs --- CLAUDE.md | 2 +- doc/functional-rules.md | 2 +- src/Service/Rtt/RttRecoveryComputationService.php | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5c1184c..69efe7d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -45,7 +45,7 @@ - Contracts >= 39h: +25% from 39h to 43h, +50% beyond - CUSTOM contracts (weeklyHours ≠ 35 and ≠ 39, not INTERIM/FORFAIT): reference = actual contractual hours, no 25%/50% bonuses (1h overtime = 1h recovery), deficit doesn't impact balance - INTERIM: no overtime bonuses, no recovery time -- Driver contracts: no overtime calculation +- Driver contracts: RTT uses `dayHoursMinutes + nightHoursMinutes + workshopHoursMinutes` instead of morning/afternoon/evening time ranges - FORFAIT weekend/holiday bonus: each weekend or public holiday day worked gives bonus leave (full day if morning+afternoon, 0.5 if only one). Added to acquired days, no cap. PRESENCE mode only. ## Frais (MileageAllowance) diff --git a/doc/functional-rules.md b/doc/functional-rules.md index 9c5cf1b..19fd2ff 100644 --- a/doc/functional-rules.md +++ b/doc/functional-rules.md @@ -154,7 +154,7 @@ Documents complementaires: - jour/nuit/atelier par jour + indicateurs repas/dîner/nuitée - panier de nuit (PN): affiché par jour si (nightMinutes > dayMinutes) OU (nightMinutes >= 240, soit au moins 4h de travail entre 21h et 6h), et total hebdo dans la colonne Jour/Nuit sem. - totaux hebdo: jour, nuit, atelier, total, compteurs petit déj/déjeuner/dîner/nuitée - - pas de calcul d'heures supplémentaires pour les conducteurs + - les conducteurs utilisent `dayHoursMinutes + nightHoursMinutes + workshopHoursMinutes` pour le calcul RTT (au lieu des créneaux morning/afternoon/evening) - Le flag `isDriver` est sur `EmployeeContractPeriod` (un employé peut changer de statut chauffeur selon la période) - Exposé en API via un getter virtuel sur `Employee` (`employee:read`) qui résout depuis la période active diff --git a/src/Service/Rtt/RttRecoveryComputationService.php b/src/Service/Rtt/RttRecoveryComputationService.php index 7a0ddf9..094ba3b 100644 --- a/src/Service/Rtt/RttRecoveryComputationService.php +++ b/src/Service/Rtt/RttRecoveryComputationService.php @@ -252,6 +252,20 @@ final readonly class RttRecoveryComputationService private function computeMetrics(WorkHour $workHour): WorkMetrics { + $driverDay = $workHour->getDayHoursMinutes() ?? 0; + $driverNight = $workHour->getNightHoursMinutes() ?? 0; + $driverWorkshop = $workHour->getWorkshopHoursMinutes() ?? 0; + + if ($driverDay > 0 || $driverNight > 0 || $driverWorkshop > 0) { + $totalMinutes = $driverDay + $driverNight + $driverWorkshop; + + return new WorkMetrics( + dayMinutes: $driverDay + $driverWorkshop, + nightMinutes: $driverNight, + totalMinutes: $totalMinutes, + ); + } + $ranges = [ [$workHour->getMorningFrom(), $workHour->getMorningTo()], [$workHour->getAfternoonFrom(), $workHour->getAfternoonTo()],