@happychef/algorithm 1.2.0 → 1.2.1

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.
@@ -1,6 +1,8 @@
1
1
  // getAvailableTimeblocks.js
2
2
 
3
3
  const { timeblocksAvailable } = require('./processing/timeblocksAvailable');
4
+ const { filterTimeblocksByMaxArrivals } = require('./filters/maxArrivalsFilter');
5
+ const { filterTimeblocksByMaxGroups } = require('./filters/maxGroupsFilter');
4
6
 
5
7
  /**
6
8
  * Parses a time string in "HH:MM" format into a Date object on a specific date.
@@ -86,7 +88,7 @@ function getAvailableTimeblocks(data, dateStr, reservations, guests, blockedSlot
86
88
  currentTimeInTimeZone.toDateString() === targetDateInTimeZone.toDateString();
87
89
 
88
90
  // Get available time blocks or shifts
89
- const availableTimeblocks = timeblocksAvailable(data, dateStr, reservations, guests, blockedSlots, giftcard, isAdmin);
91
+ let availableTimeblocks = timeblocksAvailable(data, dateStr, reservations, guests, blockedSlots, giftcard, isAdmin);
90
92
 
91
93
  // If the date is today and uurOpVoorhand is greater than zero, prune time blocks (skip for admin)
92
94
  if (!isAdmin && isToday && uurOpVoorhand >= 0) {
@@ -104,6 +106,16 @@ function getAvailableTimeblocks(data, dateStr, reservations, guests, blockedSlot
104
106
  }
105
107
  }
106
108
 
109
+ // Apply max arrivals filter (skip for admin)
110
+ if (!isAdmin) {
111
+ availableTimeblocks = filterTimeblocksByMaxArrivals(data, dateStr, availableTimeblocks, reservations, guests);
112
+ }
113
+
114
+ // Apply max groups filter (skip for admin)
115
+ if (!isAdmin) {
116
+ availableTimeblocks = filterTimeblocksByMaxGroups(data, dateStr, availableTimeblocks, reservations, guests);
117
+ }
118
+
107
119
  return availableTimeblocks;
108
120
  }
109
121
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happychef/algorithm",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Restaurant and reservation algorithm utilities",
5
5
  "main": "index.js",
6
6
  "author": "happy chef",