Skip to content

Commit

Permalink
Different approach for covers quantity check
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmitchell committed Dec 31, 2021
1 parent f629b32 commit 7786247
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion listeners/MaxOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 7786247

Please sign in to comment.