@happychef/algorithm 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -92,17 +92,18 @@ function getMealType(time) {
|
|
|
92
92
|
|
|
93
93
|
// Get max arrivals value for this specific time
|
|
94
94
|
const maxArrivals = extractNumber(maxArrivalsConfig[time]);
|
|
95
|
-
if (maxArrivals === null) {
|
|
96
|
-
// Keep the timeblock if no specific max arrivals for this time
|
|
95
|
+
if (maxArrivals === null || maxArrivals <= 0) {
|
|
96
|
+
// Keep the timeblock if no specific max arrivals for this time, or if set to 0 (unlimited)
|
|
97
97
|
filteredBlocks[time] = timeData;
|
|
98
98
|
continue;
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
// Count current arrivals at this exact time
|
|
102
102
|
const currentArrivals = countArrivalsAtTime(reservations, date, time);
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
// Only include timeblock if adding these guests doesn't exceed max arrivals
|
|
105
|
-
|
|
105
|
+
// Note: maxArrivals is the number of GROUPS (arrivals), not guests
|
|
106
|
+
if (currentArrivals + 1 <= maxArrivals) {
|
|
106
107
|
filteredBlocks[time] = timeData;
|
|
107
108
|
}
|
|
108
109
|
}
|