@happychef/algorithm 1.4.0 → 1.4.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,247 +1,247 @@
1
- const {
2
- parseTime,
3
- getMealTypeByTime,
4
- getAllTables,
5
- isTemporaryTableValid,
6
- shifts
7
- } = require('../tableHelpers');
8
-
9
- describe('tableHelpers - parseTime', () => {
10
- test('should parse valid time string correctly', () => {
11
- expect(parseTime('12:30')).toBe(750); // 12*60 + 30 = 750
12
- expect(parseTime('00:00')).toBe(0);
13
- expect(parseTime('23:59')).toBe(1439);
14
- });
15
-
16
- test('should return NaN for invalid time strings', () => {
17
- expect(parseTime('')).toBeNaN();
18
- expect(parseTime(null)).toBeNaN();
19
- expect(parseTime(undefined)).toBeNaN();
20
- expect(parseTime('25:00')).toBeNaN(); // Invalid hour
21
- expect(parseTime('12:60')).toBeNaN(); // Invalid minute
22
- expect(parseTime('12')).toBeNaN(); // Missing colon
23
- expect(parseTime('ab:cd')).toBeNaN(); // Not numbers
24
- });
25
-
26
- test('should handle edge cases', () => {
27
- expect(parseTime('0:0')).toBe(0);
28
- expect(parseTime('1:1')).toBe(61);
29
- });
30
- });
31
-
32
- describe('tableHelpers - getMealTypeByTime', () => {
33
- test('should identify breakfast times correctly', () => {
34
- expect(getMealTypeByTime('07:00')).toBe('breakfast');
35
- expect(getMealTypeByTime('09:30')).toBe('breakfast');
36
- expect(getMealTypeByTime('10:59')).toBe('breakfast');
37
- });
38
-
39
- test('should identify lunch times correctly', () => {
40
- expect(getMealTypeByTime('11:00')).toBe('lunch');
41
- expect(getMealTypeByTime('12:30')).toBe('lunch');
42
- expect(getMealTypeByTime('15:59')).toBe('lunch');
43
- });
44
-
45
- test('should identify dinner times correctly', () => {
46
- expect(getMealTypeByTime('16:00')).toBe('dinner');
47
- expect(getMealTypeByTime('18:30')).toBe('dinner');
48
- expect(getMealTypeByTime('22:59')).toBe('dinner');
49
- });
50
-
51
- test('should return null for times outside defined shifts', () => {
52
- expect(getMealTypeByTime('06:59')).toBeNull();
53
- expect(getMealTypeByTime('23:00')).toBeNull();
54
- expect(getMealTypeByTime('02:00')).toBeNull();
55
- });
56
-
57
- test('should return null for invalid time strings', () => {
58
- expect(getMealTypeByTime('invalid')).toBeNull();
59
- expect(getMealTypeByTime('')).toBeNull();
60
- expect(getMealTypeByTime(null)).toBeNull();
61
- });
62
- });
63
-
64
- describe('tableHelpers - getAllTables', () => {
65
- test('should extract tables correctly from restaurant data', () => {
66
- const restaurantData = {
67
- floors: [
68
- {
69
- tables: [
70
- {
71
- objectType: 'Tafel',
72
- id: 'table1',
73
- tableNumber: 1,
74
- minCapacity: 2,
75
- maxCapacity: 4,
76
- priority: 1,
77
- x: 10,
78
- y: 20,
79
- isTemporary: false
80
- },
81
- {
82
- objectType: 'Tafel',
83
- id: 'table2',
84
- tableNumber: { $numberInt: '2' },
85
- minCapacity: { $numberInt: '4' },
86
- maxCapacity: { $numberInt: '6' },
87
- priority: { $numberInt: '2' },
88
- x: { $numberInt: '30' },
89
- y: { $numberInt: '40' },
90
- isTemporary: false
91
- }
92
- ]
93
- }
94
- ]
95
- };
96
-
97
- const tables = getAllTables(restaurantData);
98
- expect(tables).toHaveLength(2);
99
- expect(tables[0].tableNumber).toBe(1);
100
- expect(tables[0].maxCapacity).toBe(4);
101
- expect(tables[1].tableNumber).toBe(2);
102
- expect(tables[1].maxCapacity).toBe(6);
103
- });
104
-
105
- test('should sort tables by maxCapacity, priority, and minCapacity', () => {
106
- const restaurantData = {
107
- floors: [
108
- {
109
- tables: [
110
- {
111
- objectType: 'Tafel',
112
- id: 'table1',
113
- tableNumber: 1,
114
- minCapacity: 2,
115
- maxCapacity: 6,
116
- priority: 1,
117
- x: 10,
118
- y: 20
119
- },
120
- {
121
- objectType: 'Tafel',
122
- id: 'table2',
123
- tableNumber: 2,
124
- minCapacity: 2,
125
- maxCapacity: 4,
126
- priority: 1,
127
- x: 30,
128
- y: 40
129
- }
130
- ]
131
- }
132
- ]
133
- };
134
-
135
- const tables = getAllTables(restaurantData);
136
- expect(tables[0].tableNumber).toBe(2); // Smaller maxCapacity comes first
137
- expect(tables[1].tableNumber).toBe(1);
138
- });
139
-
140
- test('should handle empty or missing data gracefully', () => {
141
- expect(getAllTables({})).toEqual([]);
142
- expect(getAllTables({ floors: [] })).toEqual([]);
143
- expect(getAllTables(null)).toEqual([]);
144
- });
145
-
146
- test('should filter out non-Tafel objects', () => {
147
- const restaurantData = {
148
- floors: [
149
- {
150
- tables: [
151
- {
152
- objectType: 'Wall',
153
- id: 'wall1',
154
- tableNumber: 1
155
- },
156
- {
157
- objectType: 'Tafel',
158
- id: 'table1',
159
- tableNumber: 2,
160
- minCapacity: 2,
161
- maxCapacity: 4,
162
- priority: 1,
163
- x: 10,
164
- y: 20
165
- }
166
- ]
167
- }
168
- ]
169
- };
170
-
171
- const tables = getAllTables(restaurantData);
172
- expect(tables).toHaveLength(1);
173
- expect(tables[0].tableNumber).toBe(2);
174
- });
175
- });
176
-
177
- describe('tableHelpers - isTemporaryTableValid', () => {
178
- test('should return true for non-temporary tables', () => {
179
- const table = {
180
- tableNumber: 1,
181
- isTemporary: false
182
- };
183
- expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(true);
184
- });
185
-
186
- test('should validate temporary table within date range and correct meal type', () => {
187
- const table = {
188
- tableNumber: 1,
189
- isTemporary: true,
190
- startDate: '2025-06-01',
191
- endDate: '2025-06-30',
192
- application: 'lunch'
193
- };
194
- expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(true);
195
- });
196
-
197
- test('should reject temporary table outside date range', () => {
198
- const table = {
199
- tableNumber: 1,
200
- isTemporary: true,
201
- startDate: '2025-06-01',
202
- endDate: '2025-06-30',
203
- application: 'lunch'
204
- };
205
- expect(isTemporaryTableValid(table, '2025-07-01', '12:00')).toBe(false);
206
- expect(isTemporaryTableValid(table, '2025-05-31', '12:00')).toBe(false);
207
- });
208
-
209
- test('should reject temporary table with wrong meal type', () => {
210
- const table = {
211
- tableNumber: 1,
212
- isTemporary: true,
213
- startDate: '2025-06-01',
214
- endDate: '2025-06-30',
215
- application: 'dinner'
216
- };
217
- expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(false); // lunch time
218
- });
219
-
220
- test('should reject temporary table with missing date range', () => {
221
- const table = {
222
- tableNumber: 1,
223
- isTemporary: true,
224
- application: 'lunch'
225
- };
226
- expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(false);
227
- });
228
-
229
- test('should reject temporary table with invalid time', () => {
230
- const table = {
231
- tableNumber: 1,
232
- isTemporary: true,
233
- startDate: '2025-06-01',
234
- endDate: '2025-06-30',
235
- application: 'lunch'
236
- };
237
- expect(isTemporaryTableValid(table, '2025-06-15', 'invalid')).toBe(false);
238
- });
239
- });
240
-
241
- describe('tableHelpers - shifts constant', () => {
242
- test('should have correct shift definitions', () => {
243
- expect(shifts.breakfast).toEqual({ start: '07:00', end: '11:00' });
244
- expect(shifts.lunch).toEqual({ start: '11:00', end: '16:00' });
245
- expect(shifts.dinner).toEqual({ start: '16:00', end: '23:00' });
246
- });
247
- });
1
+ const {
2
+ parseTime,
3
+ getMealTypeByTime,
4
+ getAllTables,
5
+ isTemporaryTableValid,
6
+ shifts
7
+ } = require('../tableHelpers');
8
+
9
+ describe('tableHelpers - parseTime', () => {
10
+ test('should parse valid time string correctly', () => {
11
+ expect(parseTime('12:30')).toBe(750); // 12*60 + 30 = 750
12
+ expect(parseTime('00:00')).toBe(0);
13
+ expect(parseTime('23:59')).toBe(1439);
14
+ });
15
+
16
+ test('should return NaN for invalid time strings', () => {
17
+ expect(parseTime('')).toBeNaN();
18
+ expect(parseTime(null)).toBeNaN();
19
+ expect(parseTime(undefined)).toBeNaN();
20
+ expect(parseTime('25:00')).toBeNaN(); // Invalid hour
21
+ expect(parseTime('12:60')).toBeNaN(); // Invalid minute
22
+ expect(parseTime('12')).toBeNaN(); // Missing colon
23
+ expect(parseTime('ab:cd')).toBeNaN(); // Not numbers
24
+ });
25
+
26
+ test('should handle edge cases', () => {
27
+ expect(parseTime('0:0')).toBe(0);
28
+ expect(parseTime('1:1')).toBe(61);
29
+ });
30
+ });
31
+
32
+ describe('tableHelpers - getMealTypeByTime', () => {
33
+ test('should identify breakfast times correctly', () => {
34
+ expect(getMealTypeByTime('07:00')).toBe('breakfast');
35
+ expect(getMealTypeByTime('09:30')).toBe('breakfast');
36
+ expect(getMealTypeByTime('10:59')).toBe('breakfast');
37
+ });
38
+
39
+ test('should identify lunch times correctly', () => {
40
+ expect(getMealTypeByTime('11:00')).toBe('lunch');
41
+ expect(getMealTypeByTime('12:30')).toBe('lunch');
42
+ expect(getMealTypeByTime('15:59')).toBe('lunch');
43
+ });
44
+
45
+ test('should identify dinner times correctly', () => {
46
+ expect(getMealTypeByTime('16:00')).toBe('dinner');
47
+ expect(getMealTypeByTime('18:30')).toBe('dinner');
48
+ expect(getMealTypeByTime('22:59')).toBe('dinner');
49
+ });
50
+
51
+ test('should return null for times outside defined shifts', () => {
52
+ expect(getMealTypeByTime('06:59')).toBeNull();
53
+ expect(getMealTypeByTime('23:00')).toBeNull();
54
+ expect(getMealTypeByTime('02:00')).toBeNull();
55
+ });
56
+
57
+ test('should return null for invalid time strings', () => {
58
+ expect(getMealTypeByTime('invalid')).toBeNull();
59
+ expect(getMealTypeByTime('')).toBeNull();
60
+ expect(getMealTypeByTime(null)).toBeNull();
61
+ });
62
+ });
63
+
64
+ describe('tableHelpers - getAllTables', () => {
65
+ test('should extract tables correctly from restaurant data', () => {
66
+ const restaurantData = {
67
+ floors: [
68
+ {
69
+ tables: [
70
+ {
71
+ objectType: 'Tafel',
72
+ id: 'table1',
73
+ tableNumber: 1,
74
+ minCapacity: 2,
75
+ maxCapacity: 4,
76
+ priority: 1,
77
+ x: 10,
78
+ y: 20,
79
+ isTemporary: false
80
+ },
81
+ {
82
+ objectType: 'Tafel',
83
+ id: 'table2',
84
+ tableNumber: { $numberInt: '2' },
85
+ minCapacity: { $numberInt: '4' },
86
+ maxCapacity: { $numberInt: '6' },
87
+ priority: { $numberInt: '2' },
88
+ x: { $numberInt: '30' },
89
+ y: { $numberInt: '40' },
90
+ isTemporary: false
91
+ }
92
+ ]
93
+ }
94
+ ]
95
+ };
96
+
97
+ const tables = getAllTables(restaurantData);
98
+ expect(tables).toHaveLength(2);
99
+ expect(tables[0].tableNumber).toBe(1);
100
+ expect(tables[0].maxCapacity).toBe(4);
101
+ expect(tables[1].tableNumber).toBe(2);
102
+ expect(tables[1].maxCapacity).toBe(6);
103
+ });
104
+
105
+ test('should sort tables by maxCapacity, priority, and minCapacity', () => {
106
+ const restaurantData = {
107
+ floors: [
108
+ {
109
+ tables: [
110
+ {
111
+ objectType: 'Tafel',
112
+ id: 'table1',
113
+ tableNumber: 1,
114
+ minCapacity: 2,
115
+ maxCapacity: 6,
116
+ priority: 1,
117
+ x: 10,
118
+ y: 20
119
+ },
120
+ {
121
+ objectType: 'Tafel',
122
+ id: 'table2',
123
+ tableNumber: 2,
124
+ minCapacity: 2,
125
+ maxCapacity: 4,
126
+ priority: 1,
127
+ x: 30,
128
+ y: 40
129
+ }
130
+ ]
131
+ }
132
+ ]
133
+ };
134
+
135
+ const tables = getAllTables(restaurantData);
136
+ expect(tables[0].tableNumber).toBe(2); // Smaller maxCapacity comes first
137
+ expect(tables[1].tableNumber).toBe(1);
138
+ });
139
+
140
+ test('should handle empty or missing data gracefully', () => {
141
+ expect(getAllTables({})).toEqual([]);
142
+ expect(getAllTables({ floors: [] })).toEqual([]);
143
+ expect(getAllTables(null)).toEqual([]);
144
+ });
145
+
146
+ test('should filter out non-Tafel objects', () => {
147
+ const restaurantData = {
148
+ floors: [
149
+ {
150
+ tables: [
151
+ {
152
+ objectType: 'Wall',
153
+ id: 'wall1',
154
+ tableNumber: 1
155
+ },
156
+ {
157
+ objectType: 'Tafel',
158
+ id: 'table1',
159
+ tableNumber: 2,
160
+ minCapacity: 2,
161
+ maxCapacity: 4,
162
+ priority: 1,
163
+ x: 10,
164
+ y: 20
165
+ }
166
+ ]
167
+ }
168
+ ]
169
+ };
170
+
171
+ const tables = getAllTables(restaurantData);
172
+ expect(tables).toHaveLength(1);
173
+ expect(tables[0].tableNumber).toBe(2);
174
+ });
175
+ });
176
+
177
+ describe('tableHelpers - isTemporaryTableValid', () => {
178
+ test('should return true for non-temporary tables', () => {
179
+ const table = {
180
+ tableNumber: 1,
181
+ isTemporary: false
182
+ };
183
+ expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(true);
184
+ });
185
+
186
+ test('should validate temporary table within date range and correct meal type', () => {
187
+ const table = {
188
+ tableNumber: 1,
189
+ isTemporary: true,
190
+ startDate: '2025-06-01',
191
+ endDate: '2025-06-30',
192
+ application: 'lunch'
193
+ };
194
+ expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(true);
195
+ });
196
+
197
+ test('should reject temporary table outside date range', () => {
198
+ const table = {
199
+ tableNumber: 1,
200
+ isTemporary: true,
201
+ startDate: '2025-06-01',
202
+ endDate: '2025-06-30',
203
+ application: 'lunch'
204
+ };
205
+ expect(isTemporaryTableValid(table, '2025-07-01', '12:00')).toBe(false);
206
+ expect(isTemporaryTableValid(table, '2025-05-31', '12:00')).toBe(false);
207
+ });
208
+
209
+ test('should reject temporary table with wrong meal type', () => {
210
+ const table = {
211
+ tableNumber: 1,
212
+ isTemporary: true,
213
+ startDate: '2025-06-01',
214
+ endDate: '2025-06-30',
215
+ application: 'dinner'
216
+ };
217
+ expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(false); // lunch time
218
+ });
219
+
220
+ test('should reject temporary table with missing date range', () => {
221
+ const table = {
222
+ tableNumber: 1,
223
+ isTemporary: true,
224
+ application: 'lunch'
225
+ };
226
+ expect(isTemporaryTableValid(table, '2025-06-15', '12:00')).toBe(false);
227
+ });
228
+
229
+ test('should reject temporary table with invalid time', () => {
230
+ const table = {
231
+ tableNumber: 1,
232
+ isTemporary: true,
233
+ startDate: '2025-06-01',
234
+ endDate: '2025-06-30',
235
+ application: 'lunch'
236
+ };
237
+ expect(isTemporaryTableValid(table, '2025-06-15', 'invalid')).toBe(false);
238
+ });
239
+ });
240
+
241
+ describe('tableHelpers - shifts constant', () => {
242
+ test('should have correct shift definitions', () => {
243
+ expect(shifts.breakfast).toEqual({ start: '07:00', end: '11:00' });
244
+ expect(shifts.lunch).toEqual({ start: '11:00', end: '16:00' });
245
+ expect(shifts.dinner).toEqual({ start: '16:00', end: '23:00' });
246
+ });
247
+ });
package/assignTables.js CHANGED
@@ -1,5 +1,4 @@
1
1
  const { tryGroupTables } = require("./grouping");
2
- const { getNextDateStr, getPrevDateStr } = require("./dateHelpers");
3
2
 
4
3
  /**
5
4
  * server side
@@ -357,67 +356,6 @@ async function assignTablesIfPossible({
357
356
  }
358
357
  }
359
358
 
360
- // 9b) Cross-date table conflicts: include previous-day reservations that spill past midnight
361
- const prevDateStr = getPrevDateStr(date);
362
- const prevDayReservations = await db.collection('reservations').find({
363
- restaurantId: restaurantId,
364
- date: prevDateStr
365
- }).toArray();
366
-
367
- for (let r of prevDayReservations) {
368
- let rDuration = duurReservatie;
369
- if (r.duration) {
370
- const rawDur = r.duration.$numberInt ?? r.duration;
371
- const parsed = parseInt(rawDur, 10);
372
- if (!isNaN(parsed) && parsed > 0) {
373
- rDuration = parsed;
374
- }
375
- }
376
- const startMinutes = parseTime(r.time);
377
- if (!isNaN(startMinutes) && startMinutes + rDuration > 1440 && r.tables) {
378
- // This previous-day reservation crosses midnight into current day
379
- const rSlots = computeRequiredSlots(r.time, rDuration, intervalReservatie);
380
- for (let tn of r.tables) {
381
- if (!tableOccupiedSlots[tn]) {
382
- tableOccupiedSlots[tn] = new Set();
383
- }
384
- // Slots >1440 naturally overlap with current day's late-night slots on the same table
385
- rSlots.forEach(slot => tableOccupiedSlots[tn].add(slot));
386
- }
387
- }
388
- }
389
-
390
- // 9c) If new reservation crosses midnight, include next-day reservations offset by +1440
391
- const crossesMidnight = requiredSlots.some(s => s >= 1440);
392
- if (crossesMidnight) {
393
- const nextDateStr = getNextDateStr(date);
394
- const nextDayReservations = await db.collection('reservations').find({
395
- restaurantId: restaurantId,
396
- date: nextDateStr
397
- }).toArray();
398
-
399
- for (let r of nextDayReservations) {
400
- let rDuration = duurReservatie;
401
- if (r.duration) {
402
- const rawDur = r.duration.$numberInt ?? r.duration;
403
- const parsed = parseInt(rawDur, 10);
404
- if (!isNaN(parsed) && parsed > 0) {
405
- rDuration = parsed;
406
- }
407
- }
408
- const rSlots = computeRequiredSlots(r.time, rDuration, intervalReservatie);
409
- if (r.tables) {
410
- for (let tn of r.tables) {
411
- if (!tableOccupiedSlots[tn]) {
412
- tableOccupiedSlots[tn] = new Set();
413
- }
414
- // Offset next-day slots by +1440 so they align with our cross-midnight slots
415
- rSlots.forEach(slot => tableOccupiedSlots[tn].add(slot + 1440));
416
- }
417
- }
418
- }
419
- }
420
-
421
359
  // 10) Helper function to try table assignment from a given set of tables
422
360
  function tryAssignTables(tables, label) {
423
361
  // Sort tables
@@ -0,0 +1,100 @@
1
+ // bundle_entry.js - Entry point for esbuild bundling
2
+ // Exposes all @happychef/algorithm functions on globalThis.HappyAlgorithm
3
+ // for use with flutter_js (QuickJS / JavaScriptCore)
4
+
5
+ const algorithm = require('./index.js');
6
+
7
+ // Intl.DateTimeFormat polyfill for QuickJS (which lacks Intl support)
8
+ if (typeof globalThis.Intl === 'undefined' || typeof globalThis.Intl.DateTimeFormat === 'undefined') {
9
+ // EU DST rules for Europe/Brussels
10
+ function getBrusselsOffsetHours(date) {
11
+ const year = date.getUTCFullYear();
12
+ const marchLast = new Date(Date.UTC(year, 2, 31));
13
+ const marchSunday = 31 - marchLast.getUTCDay();
14
+ const dstStart = Date.UTC(year, 2, marchSunday, 1, 0, 0);
15
+ const octLast = new Date(Date.UTC(year, 9, 31));
16
+ const octSunday = 31 - octLast.getUTCDay();
17
+ const dstEnd = Date.UTC(year, 9, octSunday, 1, 0, 0);
18
+ const ts = date.getTime();
19
+ return (ts >= dstStart && ts < dstEnd) ? 2 : 1;
20
+ }
21
+
22
+ if (!globalThis.Intl) globalThis.Intl = {};
23
+
24
+ globalThis.Intl.DateTimeFormat = function IntlDateTimeFormat(locale, options) {
25
+ this._options = options || {};
26
+ this.formatToParts = function(date) {
27
+ const d = date || new Date();
28
+ const tz = (this._options.timeZone || '').replace(/\//g, '/');
29
+ // Only support Europe/Brussels
30
+ const offset = getBrusselsOffsetHours(d);
31
+ const brusselsDate = new Date(d.getTime() + offset * 60 * 60 * 1000);
32
+ const parts = [];
33
+ if (this._options.hour) {
34
+ parts.push({ type: 'hour', value: String(brusselsDate.getUTCHours()).padStart(2, '0') });
35
+ }
36
+ if (this._options.minute) {
37
+ parts.push({ type: 'literal', value: ':' });
38
+ parts.push({ type: 'minute', value: String(brusselsDate.getUTCMinutes()).padStart(2, '0') });
39
+ }
40
+ return parts;
41
+ };
42
+ this.format = function(date) {
43
+ return this.formatToParts(date).map(function(p) { return p.value; }).join('');
44
+ };
45
+ };
46
+ }
47
+
48
+ // Expose all algorithm functions globally
49
+ globalThis.HappyAlgorithm = {
50
+ // Core availability functions
51
+ getAvailableTimeblocks: algorithm.getAvailableTimeblocks,
52
+ isDateAvailable: algorithm.isDateAvailable,
53
+ isDateAvailableWithTableCheck: algorithm.isDateAvailableWithTableCheck,
54
+ isTimeAvailable: algorithm.isTimeAvailable,
55
+
56
+ // Table assignment functions
57
+ isTimeAvailableSync: algorithm.isTimeAvailableSync,
58
+ filterTimeblocksByTableAvailability: algorithm.filterTimeblocksByTableAvailability,
59
+ getAvailableTimeblocksWithTableCheck: algorithm.getAvailableTimeblocksWithTableCheck,
60
+ getAvailableTablesForTime: algorithm.getAvailableTablesForTime,
61
+
62
+ // Processing functions
63
+ timeblocksAvailable: algorithm.timeblocksAvailable,
64
+ getDailyGuestCounts: algorithm.getDailyGuestCounts,
65
+
66
+ // Filter functions
67
+ filterTimeblocksByStopTimes: algorithm.filterTimeblocksByStopTimes,
68
+ filterTimeblocksByMaxArrivals: algorithm.filterTimeblocksByMaxArrivals,
69
+ filterTimeblocksByMaxGroups: algorithm.filterTimeblocksByMaxGroups,
70
+
71
+ // Table helpers
72
+ parseTime: algorithm.parseTime,
73
+ getMealTypeByTime: algorithm.getMealTypeByTime,
74
+ getAllTables: algorithm.getAllTables,
75
+ getFloorIdForSeatPlace: algorithm.getFloorIdForSeatPlace,
76
+ isTemporaryTableValid: algorithm.isTemporaryTableValid,
77
+
78
+ // Grouping
79
+ tryGroupTables: algorithm.tryGroupTables,
80
+
81
+ // Batch functions for calendar performance (avoid 30 separate JSON serializations)
82
+ batchIsDateAvailable: function(data, dates, reservations, guests, blockedSlots, giftcard, isAdmin, duration) {
83
+ var result = {};
84
+ for (var i = 0; i < dates.length; i++) {
85
+ result[dates[i]] = algorithm.isDateAvailable(data, dates[i], reservations, guests, blockedSlots, giftcard, isAdmin, duration);
86
+ }
87
+ return result;
88
+ },
89
+
90
+ batchIsDateAvailableWithTableCheck: function(data, dates, reservations, guests, blockedSlots, selectedGiftcard, isAdmin, duration, selectedZitplaats) {
91
+ var result = {};
92
+ for (var i = 0; i < dates.length; i++) {
93
+ result[dates[i]] = algorithm.isDateAvailableWithTableCheck(data, dates[i], reservations, guests, blockedSlots, selectedGiftcard, isAdmin, duration, selectedZitplaats);
94
+ }
95
+ return result;
96
+ },
97
+
98
+ // Version info
99
+ VERSION: '1.2.29'
100
+ };