feat(heures) : export Contingent heures de nuit (liste employés) #28

Merged
tristan merged 17 commits from feat/night-hours-contingent-export into develop 2026-06-11 13:02:31 +00:00
2 changed files with 11 additions and 1 deletions
Showing only changes of commit bd1a9d120e - Show all commits
@@ -13,7 +13,7 @@ use App\Entity\WorkHour;
* (21:00-24:00). On projette sur J+1 pour les shifts qui traversent minuit.
* Source de verite unique partagee par les ecrans Heures et les exports.
*/
final class NightHoursCalculator
final readonly class NightHoursCalculator
{
/**
* Minutes de nuit d'un WorkHour. Conducteurs : champ manuel nightHoursMinutes.
@@ -19,6 +19,7 @@ final class NightHoursCalculatorTest extends TestCase
$calc = new NightHoursCalculator();
self::assertSame(0, $calc->nightIntervalMinutes(null, null));
self::assertSame(0, $calc->nightIntervalMinutes('08:00', null));
self::assertSame(0, $calc->nightIntervalMinutes(null, '17:00'));
}
public function testPureDayRangeHasNoNight(): void
@@ -28,6 +29,15 @@ final class NightHoursCalculatorTest extends TestCase
self::assertSame(0, $calc->nightIntervalMinutes('08:00', '17:00'));
}
public function testWindowBoundariesAreRightExclusive(): void
{
$calc = new NightHoursCalculator();
// 06:00 -> 21:00 : pile entre les deux fenetres de nuit, 0 min.
self::assertSame(0, $calc->nightIntervalMinutes('06:00', '21:00'));
// 22:00 -> 06:00 : 22-24 (120) + 00-06 (360) = 480, borne 06:00 exclue.
self::assertSame(480, $calc->nightIntervalMinutes('22:00', '06:00'));
}
public function testEveningWindowCounts(): void
{
$calc = new NightHoursCalculator();