From 77862478cc4794917d81d4fc3450cc2bc6920256 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 31 Dec 2021 15:33:10 +0000 Subject: [PATCH] Different approach for covers quantity check --- listeners/MaxOrders.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/listeners/MaxOrders.php b/listeners/MaxOrders.php index 15ab9ae..9d1f835 100644 --- a/listeners/MaxOrders.php +++ b/listeners/MaxOrders.php @@ -155,12 +155,17 @@ private function checkTimeslot($workingScheduleType, $timeslot, $checkLocationSe // get sum of all covers $orderCount = $timeslotOrders->sum() + $addAdditionalCovers; + // for covers we may already be at the max, in which case we remove the slot + if ($orderCount == $limitation->timeslot_max) { + $removeSlot = true; + } + // otherwise we count orders on this day } else { $orderCount = $timeslotOrders->count() + $addAdditionalOrders; } - if ($orderCount >= $limitation->timeslot_max) + if ($orderCount > $limitation->timeslot_max) $removeSlot = true; } }