From 89b70e44f519ef28c0ac1738066b2662b271208a Mon Sep 17 00:00:00 2001 From: Michiel Vanzeir Date: Sun, 1 Dec 2024 22:48:17 +0100 Subject: [PATCH 1/2] Fix shift overlap bug: update logic to handle shifts starting and ending at the same time --- module/ShiftBundle/Entity/RegistrationShift.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ShiftBundle/Entity/RegistrationShift.php b/module/ShiftBundle/Entity/RegistrationShift.php index 4679ad7257..bbd7d93178 100644 --- a/module/ShiftBundle/Entity/RegistrationShift.php +++ b/module/ShiftBundle/Entity/RegistrationShift.php @@ -402,7 +402,7 @@ public function canHaveAsRegistered(EntityManager $entityManager, Person $regist return false; } - if ($this->getStartDate() < $shift->getEndDate() && $shift->getStartDate() < $this->getEndDate()) { + if ($this->getStartDate() < $shift->getEndDate() && $shift->getStartDate() < $this->getEndDate() || $this->getStartDate() === $shift->getStartDate()) { return false; } From c7aa94a94799f0a56e311b5e13faa88d32ba583a Mon Sep 17 00:00:00 2001 From: Michiel Vanzeir Date: Fri, 6 Dec 2024 18:16:35 +0100 Subject: [PATCH 2/2] Fix shift overlap bug: update logic to handle shifts starting and ending at the same time --- module/ShiftBundle/Entity/Shift.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/ShiftBundle/Entity/Shift.php b/module/ShiftBundle/Entity/Shift.php index 27808c86eb..394829c158 100644 --- a/module/ShiftBundle/Entity/Shift.php +++ b/module/ShiftBundle/Entity/Shift.php @@ -493,7 +493,7 @@ public function canHaveAsVolunteer(EntityManager $entityManager, Person $person) return false; } - if ($this->getStartDate() < $shift->getEndDate() && $shift->getStartDate() < $this->getEndDate()) { + if ($this->getStartDate() < $shift->getEndDate() && $shift->getStartDate() < $this->getEndDate() || $shift->getStartDate() === $this->getStartDate()) { return false; } }