@happychef/algorithm 1.2.9 → 1.2.11

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,100 +1,100 @@
1
- // Detailed filter test - simulating getAvailableTimeblocks logic
2
- const { timeblocksAvailable } = require('./processing/timeblocksAvailable');
3
- const { getMealTypeByTime, parseTime } = require('./tableHelpers');
4
-
5
- const restaurantData = {
6
- "_id": "demo",
7
- "openinghours-lunch": {
8
- "schemeSettings": {
9
- "Monday": {
10
- "enabled": true,
11
- "startTime": "14:15",
12
- "endTime": "15:00",
13
- "maxCapacityEnabled": true,
14
- "maxCapacity": "10"
15
- }
16
- }
17
- },
18
- "general-settings": {
19
- "zitplaatsen": 13,
20
- "uurOpVoorhand": 0,
21
- "dagenInToekomst": 365,
22
- "intervalReservatie": 30,
23
- "duurReservatie": 60,
24
- "ontbijtStop": "",
25
- "lunchStop": "",
26
- "dinerStop": ""
27
- },
28
- "max-arrivals-lunch": {
29
- "14:15": 10,
30
- "14:30": 10,
31
- "14:45": 10
32
- }
33
- };
34
-
35
- const testDate = "2025-12-08";
36
- const guests = 2;
37
- const reservations = [];
38
- const uurOpVoorhand = 0;
39
- const isAdmin = false;
40
-
41
- console.log('=== DETAILED FILTER TEST ===\n');
42
-
43
- // Get timeblocks
44
- const availableTimeblocks = timeblocksAvailable(restaurantData, testDate, reservations, guests, [], null, isAdmin);
45
- console.log('Initial timeblocks:', Object.keys(availableTimeblocks));
46
-
47
- // Simulate the time filtering logic
48
- const now = new Date();
49
- const [year, month, day] = testDate.split('-').map(Number);
50
- const targetDateInTimeZone = new Date(year, month - 1, day);
51
- const isToday = now.toDateString() === targetDateInTimeZone.toDateString();
52
-
53
- console.log('\nTime filter check:');
54
- console.log('Is today:', isToday);
55
- console.log('uurOpVoorhand:', uurOpVoorhand);
56
- console.log('Current time:', now.toString());
57
-
58
- if (isToday && uurOpVoorhand >= 0) {
59
- const cutoffTime = new Date(now.getTime());
60
- cutoffTime.setHours(cutoffTime.getHours() + uurOpVoorhand);
61
- console.log('Cutoff time:', cutoffTime.toString());
62
-
63
- for (const key of Object.keys(availableTimeblocks)) {
64
- const timeStr = key;
65
- const [hours, minutes] = timeStr.split(':').map(Number);
66
- const timeBlockDateTime = new Date(year, month - 1, day, hours, minutes);
67
-
68
- console.log(`\n Checking ${timeStr}:`);
69
- console.log(` timeBlockDateTime: ${timeBlockDateTime.toString()}`);
70
- console.log(` cutoffTime: ${cutoffTime.toString()}`);
71
- console.log(` timeBlockDateTime < cutoffTime: ${timeBlockDateTime < cutoffTime}`);
72
- console.log(` Would be deleted: ${timeBlockDateTime < cutoffTime ? 'YES' : 'NO'}`);
73
- }
74
- }
75
-
76
- // Check lunchStop filter
77
- console.log('\n\nLunch Stop filter check:');
78
- const settings = restaurantData['general-settings'];
79
- const lunchStop = settings.lunchStop || null;
80
- console.log('lunchStop value:', JSON.stringify(lunchStop));
81
- console.log('lunchStop truthy:', !!lunchStop);
82
-
83
- if (lunchStop) {
84
- console.log('LunchStop is set, would apply filter');
85
- for (const time in availableTimeblocks) {
86
- const mealType = getMealTypeByTime(time);
87
- console.log(` ${time}: mealType=${mealType}`);
88
-
89
- if (mealType === 'lunch') {
90
- const timeMinutes = parseTime(time);
91
- const stopMinutes = parseTime(lunchStop);
92
- console.log(` timeMinutes=${timeMinutes}, stopMinutes=${stopMinutes}`);
93
- console.log(` Would remove: ${timeMinutes >= stopMinutes ? 'YES' : 'NO'}`);
94
- }
95
- }
96
- } else {
97
- console.log('LunchStop is NOT set, no filter applied');
98
- }
99
-
100
- console.log('\n=== END TEST ===');
1
+ // Detailed filter test - simulating getAvailableTimeblocks logic
2
+ const { timeblocksAvailable } = require('./processing/timeblocksAvailable');
3
+ const { getMealTypeByTime, parseTime } = require('./tableHelpers');
4
+
5
+ const restaurantData = {
6
+ "_id": "demo",
7
+ "openinghours-lunch": {
8
+ "schemeSettings": {
9
+ "Monday": {
10
+ "enabled": true,
11
+ "startTime": "14:15",
12
+ "endTime": "15:00",
13
+ "maxCapacityEnabled": true,
14
+ "maxCapacity": "10"
15
+ }
16
+ }
17
+ },
18
+ "general-settings": {
19
+ "zitplaatsen": 13,
20
+ "uurOpVoorhand": 0,
21
+ "dagenInToekomst": 365,
22
+ "intervalReservatie": 30,
23
+ "duurReservatie": 60,
24
+ "ontbijtStop": "",
25
+ "lunchStop": "",
26
+ "dinerStop": ""
27
+ },
28
+ "max-arrivals-lunch": {
29
+ "14:15": 10,
30
+ "14:30": 10,
31
+ "14:45": 10
32
+ }
33
+ };
34
+
35
+ const testDate = "2025-12-08";
36
+ const guests = 2;
37
+ const reservations = [];
38
+ const uurOpVoorhand = 0;
39
+ const isAdmin = false;
40
+
41
+ console.log('=== DETAILED FILTER TEST ===\n');
42
+
43
+ // Get timeblocks
44
+ const availableTimeblocks = timeblocksAvailable(restaurantData, testDate, reservations, guests, [], null, isAdmin);
45
+ console.log('Initial timeblocks:', Object.keys(availableTimeblocks));
46
+
47
+ // Simulate the time filtering logic
48
+ const now = new Date();
49
+ const [year, month, day] = testDate.split('-').map(Number);
50
+ const targetDateInTimeZone = new Date(year, month - 1, day);
51
+ const isToday = now.toDateString() === targetDateInTimeZone.toDateString();
52
+
53
+ console.log('\nTime filter check:');
54
+ console.log('Is today:', isToday);
55
+ console.log('uurOpVoorhand:', uurOpVoorhand);
56
+ console.log('Current time:', now.toString());
57
+
58
+ if (isToday && uurOpVoorhand >= 0) {
59
+ const cutoffTime = new Date(now.getTime());
60
+ cutoffTime.setHours(cutoffTime.getHours() + uurOpVoorhand);
61
+ console.log('Cutoff time:', cutoffTime.toString());
62
+
63
+ for (const key of Object.keys(availableTimeblocks)) {
64
+ const timeStr = key;
65
+ const [hours, minutes] = timeStr.split(':').map(Number);
66
+ const timeBlockDateTime = new Date(year, month - 1, day, hours, minutes);
67
+
68
+ console.log(`\n Checking ${timeStr}:`);
69
+ console.log(` timeBlockDateTime: ${timeBlockDateTime.toString()}`);
70
+ console.log(` cutoffTime: ${cutoffTime.toString()}`);
71
+ console.log(` timeBlockDateTime < cutoffTime: ${timeBlockDateTime < cutoffTime}`);
72
+ console.log(` Would be deleted: ${timeBlockDateTime < cutoffTime ? 'YES' : 'NO'}`);
73
+ }
74
+ }
75
+
76
+ // Check lunchStop filter
77
+ console.log('\n\nLunch Stop filter check:');
78
+ const settings = restaurantData['general-settings'];
79
+ const lunchStop = settings.lunchStop || null;
80
+ console.log('lunchStop value:', JSON.stringify(lunchStop));
81
+ console.log('lunchStop truthy:', !!lunchStop);
82
+
83
+ if (lunchStop) {
84
+ console.log('LunchStop is set, would apply filter');
85
+ for (const time in availableTimeblocks) {
86
+ const mealType = getMealTypeByTime(time);
87
+ console.log(` ${time}: mealType=${mealType}`);
88
+
89
+ if (mealType === 'lunch') {
90
+ const timeMinutes = parseTime(time);
91
+ const stopMinutes = parseTime(lunchStop);
92
+ console.log(` timeMinutes=${timeMinutes}, stopMinutes=${stopMinutes}`);
93
+ console.log(` Would remove: ${timeMinutes >= stopMinutes ? 'YES' : 'NO'}`);
94
+ }
95
+ }
96
+ } else {
97
+ console.log('LunchStop is NOT set, no filter applied');
98
+ }
99
+
100
+ console.log('\n=== END TEST ===');
@@ -1,110 +1,110 @@
1
- // Test script to debug why Monday lunch isn't showing
2
- const { getAvailableTimeblocks } = require('./getAvailableTimeblocks');
3
- const { timeblocksAvailable } = require('./processing/timeblocksAvailable');
4
- const { getDailyGuestCounts } = require('./processing/dailyGuestCounts');
5
-
6
- // Your restaurant data
7
- const restaurantData = {
8
- "_id": "demo",
9
- "openinghours-lunch": {
10
- "schemeSettings": {
11
- "Monday": {
12
- "enabled": true,
13
- "startTime": "14:15",
14
- "endTime": "15:00",
15
- "maxCapacityEnabled": true,
16
- "maxCapacity": "10",
17
- "shiftsEnabled": false,
18
- "shifts": [],
19
- "giftcardsEnabled": false,
20
- "giftcards": [],
21
- "giftcardTakeawayEnabled": false,
22
- "giftcardTakeawayStart": "",
23
- "giftcardTakeawayEnd": ""
24
- },
25
- "Wednesday": {
26
- "enabled": true,
27
- "startTime": "13:45",
28
- "endTime": "14:45",
29
- "maxCapacityEnabled": false,
30
- "maxCapacity": "",
31
- "shiftsEnabled": false,
32
- "shifts": [],
33
- "giftcardsEnabled": false,
34
- "giftcards": [],
35
- "giftcardTakeawayEnabled": true,
36
- "giftcardTakeawayStart": "11:00",
37
- "giftcardTakeawayEnd": "16:00"
38
- }
39
- }
40
- },
41
- "general-settings": {
42
- "zitplaatsen": 13,
43
- "uurOpVoorhand": 0,
44
- "dagenInToekomst": 365,
45
- "minGasten": 1,
46
- "maxGasten": 10,
47
- "intervalReservatie": 30,
48
- "duurReservatie": 60,
49
- "ontbijtStop": "",
50
- "lunchStop": "",
51
- "dinerStop": ""
52
- },
53
- "max-arrivals-lunch": {
54
- "12:00": 6,
55
- "12:15": 1,
56
- "12:30": 6,
57
- "12:45": 4,
58
- "13:00": 10,
59
- "14:15": 10,
60
- "14:30": 10,
61
- "14:45": 10,
62
- "storedNumber": 30
63
- },
64
- "exceptions": [],
65
- "blocked-slots": []
66
- };
67
-
68
- // Test for Monday December 8, 2025
69
- const testDate = "2025-12-08"; // Monday
70
- const guests = 2;
71
- const reservations = [];
72
-
73
- console.log('=== LUNCH AVAILABILITY DEBUG ===\n');
74
- console.log('Date:', testDate, '(Monday)');
75
- console.log('Guests:', guests);
76
- console.log('Current time:', new Date().toISOString());
77
- console.log('\n--- Restaurant Settings ---');
78
- console.log('Lunch Opening Hours (Monday):', restaurantData['openinghours-lunch'].schemeSettings.Monday);
79
- console.log('General Settings:', restaurantData['general-settings']);
80
- console.log('Max Arrivals Lunch:', restaurantData['max-arrivals-lunch']);
81
-
82
- console.log('\n--- Step 1: getDailyGuestCounts ---');
83
- const { guestCounts, shiftsInfo } = getDailyGuestCounts(restaurantData, testDate, reservations);
84
- console.log('Guest Counts:', guestCounts);
85
- console.log('Shifts Info:', shiftsInfo);
86
-
87
- console.log('\n--- Step 2: timeblocksAvailable ---');
88
- const timeblocks = timeblocksAvailable(restaurantData, testDate, reservations, guests, [], null, false);
89
- console.log('Available Timeblocks:', timeblocks);
90
-
91
- console.log('\n--- Step 3: getAvailableTimeblocks (with filters) ---');
92
- const finalTimeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, false);
93
- console.log('Final Available Timeblocks:', finalTimeblocks);
94
-
95
- console.log('\n--- Step 4: Test with Admin Flag ---');
96
- const adminTimeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, true);
97
- console.log('Admin Timeblocks (no time restrictions):', adminTimeblocks);
98
-
99
- // Check if lunch times exist
100
- const lunchTimes = ['14:15', '14:30', '14:45'];
101
- console.log('\n--- Lunch Time Analysis ---');
102
- lunchTimes.forEach(time => {
103
- console.log(`${time}:`);
104
- console.log(` - In guestCounts: ${guestCounts.hasOwnProperty(time) ? 'YES (capacity: ' + guestCounts[time] + ')' : 'NO'}`);
105
- console.log(` - In timeblocks: ${timeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
106
- console.log(` - In final: ${finalTimeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
107
- console.log(` - In admin: ${adminTimeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
108
- });
109
-
110
- console.log('\n=== END DEBUG ===');
1
+ // Test script to debug why Monday lunch isn't showing
2
+ const { getAvailableTimeblocks } = require('./getAvailableTimeblocks');
3
+ const { timeblocksAvailable } = require('./processing/timeblocksAvailable');
4
+ const { getDailyGuestCounts } = require('./processing/dailyGuestCounts');
5
+
6
+ // Your restaurant data
7
+ const restaurantData = {
8
+ "_id": "demo",
9
+ "openinghours-lunch": {
10
+ "schemeSettings": {
11
+ "Monday": {
12
+ "enabled": true,
13
+ "startTime": "14:15",
14
+ "endTime": "15:00",
15
+ "maxCapacityEnabled": true,
16
+ "maxCapacity": "10",
17
+ "shiftsEnabled": false,
18
+ "shifts": [],
19
+ "giftcardsEnabled": false,
20
+ "giftcards": [],
21
+ "giftcardTakeawayEnabled": false,
22
+ "giftcardTakeawayStart": "",
23
+ "giftcardTakeawayEnd": ""
24
+ },
25
+ "Wednesday": {
26
+ "enabled": true,
27
+ "startTime": "13:45",
28
+ "endTime": "14:45",
29
+ "maxCapacityEnabled": false,
30
+ "maxCapacity": "",
31
+ "shiftsEnabled": false,
32
+ "shifts": [],
33
+ "giftcardsEnabled": false,
34
+ "giftcards": [],
35
+ "giftcardTakeawayEnabled": true,
36
+ "giftcardTakeawayStart": "11:00",
37
+ "giftcardTakeawayEnd": "16:00"
38
+ }
39
+ }
40
+ },
41
+ "general-settings": {
42
+ "zitplaatsen": 13,
43
+ "uurOpVoorhand": 0,
44
+ "dagenInToekomst": 365,
45
+ "minGasten": 1,
46
+ "maxGasten": 10,
47
+ "intervalReservatie": 30,
48
+ "duurReservatie": 60,
49
+ "ontbijtStop": "",
50
+ "lunchStop": "",
51
+ "dinerStop": ""
52
+ },
53
+ "max-arrivals-lunch": {
54
+ "12:00": 6,
55
+ "12:15": 1,
56
+ "12:30": 6,
57
+ "12:45": 4,
58
+ "13:00": 10,
59
+ "14:15": 10,
60
+ "14:30": 10,
61
+ "14:45": 10,
62
+ "storedNumber": 30
63
+ },
64
+ "exceptions": [],
65
+ "blocked-slots": []
66
+ };
67
+
68
+ // Test for Monday December 8, 2025
69
+ const testDate = "2025-12-08"; // Monday
70
+ const guests = 2;
71
+ const reservations = [];
72
+
73
+ console.log('=== LUNCH AVAILABILITY DEBUG ===\n');
74
+ console.log('Date:', testDate, '(Monday)');
75
+ console.log('Guests:', guests);
76
+ console.log('Current time:', new Date().toISOString());
77
+ console.log('\n--- Restaurant Settings ---');
78
+ console.log('Lunch Opening Hours (Monday):', restaurantData['openinghours-lunch'].schemeSettings.Monday);
79
+ console.log('General Settings:', restaurantData['general-settings']);
80
+ console.log('Max Arrivals Lunch:', restaurantData['max-arrivals-lunch']);
81
+
82
+ console.log('\n--- Step 1: getDailyGuestCounts ---');
83
+ const { guestCounts, shiftsInfo } = getDailyGuestCounts(restaurantData, testDate, reservations);
84
+ console.log('Guest Counts:', guestCounts);
85
+ console.log('Shifts Info:', shiftsInfo);
86
+
87
+ console.log('\n--- Step 2: timeblocksAvailable ---');
88
+ const timeblocks = timeblocksAvailable(restaurantData, testDate, reservations, guests, [], null, false);
89
+ console.log('Available Timeblocks:', timeblocks);
90
+
91
+ console.log('\n--- Step 3: getAvailableTimeblocks (with filters) ---');
92
+ const finalTimeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, false);
93
+ console.log('Final Available Timeblocks:', finalTimeblocks);
94
+
95
+ console.log('\n--- Step 4: Test with Admin Flag ---');
96
+ const adminTimeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, true);
97
+ console.log('Admin Timeblocks (no time restrictions):', adminTimeblocks);
98
+
99
+ // Check if lunch times exist
100
+ const lunchTimes = ['14:15', '14:30', '14:45'];
101
+ console.log('\n--- Lunch Time Analysis ---');
102
+ lunchTimes.forEach(time => {
103
+ console.log(`${time}:`);
104
+ console.log(` - In guestCounts: ${guestCounts.hasOwnProperty(time) ? 'YES (capacity: ' + guestCounts[time] + ')' : 'NO'}`);
105
+ console.log(` - In timeblocks: ${timeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
106
+ console.log(` - In final: ${finalTimeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
107
+ console.log(` - In admin: ${adminTimeblocks.hasOwnProperty(time) ? 'YES' : 'NO'}`);
108
+ });
109
+
110
+ console.log('\n=== END DEBUG ===');
@@ -1,79 +1,79 @@
1
- // Test the max arrivals filter specifically
2
- const { filterTimeblocksByMaxArrivals } = require('./filters/maxArrivalsFilter');
3
- const { getAvailableTimeblocks } = require('./getAvailableTimeblocks');
4
-
5
- const restaurantData = {
6
- "_id": "demo",
7
- "openinghours-lunch": {
8
- "schemeSettings": {
9
- "Monday": {
10
- "enabled": true,
11
- "startTime": "14:15",
12
- "endTime": "15:00",
13
- "maxCapacityEnabled": true,
14
- "maxCapacity": "10"
15
- }
16
- }
17
- },
18
- "general-settings": {
19
- "zitplaatsen": 13,
20
- "uurOpVoorhand": 0,
21
- "dagenInToekomst": 365,
22
- "intervalReservatie": 30,
23
- "duurReservatie": 60,
24
- "ontbijtStop": "",
25
- "lunchStop": "",
26
- "dinerStop": ""
27
- },
28
- "max-arrivals-lunch": {
29
- "12:00": 6,
30
- "12:15": 1,
31
- "12:30": 6,
32
- "12:45": 4,
33
- "13:00": 10,
34
- "14:15": 10,
35
- "14:30": 10,
36
- "14:45": 10,
37
- "storedNumber": 30
38
- }
39
- };
40
-
41
- const testDate = "2025-12-08";
42
- const guests = 2;
43
- const reservations = [];
44
-
45
- console.log('=== MAX ARRIVALS FILTER TEST ===\n');
46
-
47
- // Get initial timeblocks from algorithm
48
- const timeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, true);
49
- console.log('Timeblocks from algorithm (admin mode):', Object.keys(timeblocks));
50
-
51
- // Apply max arrivals filter
52
- const filtered = filterTimeblocksByMaxArrivals(restaurantData, testDate, timeblocks, reservations, guests);
53
- console.log('\nAfter max arrivals filter:', Object.keys(filtered));
54
-
55
- // Debug each time slot
56
- console.log('\n--- Detailed Analysis ---');
57
- for (const time of Object.keys(timeblocks)) {
58
- const maxArrivalsConfig = restaurantData['max-arrivals-lunch'];
59
- const maxArrivals = maxArrivalsConfig ? maxArrivalsConfig[time] : null;
60
-
61
- const currentArrivals = reservations
62
- .filter(r => r.date === testDate && r.time === time)
63
- .reduce((sum, r) => sum + (parseInt(r.guests, 10) || 0), 0);
64
-
65
- const isInFiltered = filtered.hasOwnProperty(time);
66
-
67
- console.log(`\n${time}:`);
68
- console.log(` Max arrivals setting: ${maxArrivals || 'NOT SET'}`);
69
- console.log(` Current arrivals: ${currentArrivals}`);
70
- console.log(` New reservation: ${guests} guests`);
71
- console.log(` Total after adding: ${currentArrivals + guests}`);
72
- console.log(` Passes filter: ${isInFiltered ? 'YES' : 'NO'}`);
73
-
74
- if (maxArrivals !== null && maxArrivals !== undefined) {
75
- console.log(` Logic: ${currentArrivals} + ${guests} = ${currentArrivals + guests} ${currentArrivals + guests <= maxArrivals ? '<=' : '>'} ${maxArrivals}`);
76
- }
77
- }
78
-
79
- console.log('\n=== END TEST ===');
1
+ // Test the max arrivals filter specifically
2
+ const { filterTimeblocksByMaxArrivals } = require('./filters/maxArrivalsFilter');
3
+ const { getAvailableTimeblocks } = require('./getAvailableTimeblocks');
4
+
5
+ const restaurantData = {
6
+ "_id": "demo",
7
+ "openinghours-lunch": {
8
+ "schemeSettings": {
9
+ "Monday": {
10
+ "enabled": true,
11
+ "startTime": "14:15",
12
+ "endTime": "15:00",
13
+ "maxCapacityEnabled": true,
14
+ "maxCapacity": "10"
15
+ }
16
+ }
17
+ },
18
+ "general-settings": {
19
+ "zitplaatsen": 13,
20
+ "uurOpVoorhand": 0,
21
+ "dagenInToekomst": 365,
22
+ "intervalReservatie": 30,
23
+ "duurReservatie": 60,
24
+ "ontbijtStop": "",
25
+ "lunchStop": "",
26
+ "dinerStop": ""
27
+ },
28
+ "max-arrivals-lunch": {
29
+ "12:00": 6,
30
+ "12:15": 1,
31
+ "12:30": 6,
32
+ "12:45": 4,
33
+ "13:00": 10,
34
+ "14:15": 10,
35
+ "14:30": 10,
36
+ "14:45": 10,
37
+ "storedNumber": 30
38
+ }
39
+ };
40
+
41
+ const testDate = "2025-12-08";
42
+ const guests = 2;
43
+ const reservations = [];
44
+
45
+ console.log('=== MAX ARRIVALS FILTER TEST ===\n');
46
+
47
+ // Get initial timeblocks from algorithm
48
+ const timeblocks = getAvailableTimeblocks(restaurantData, testDate, reservations, guests, [], null, true);
49
+ console.log('Timeblocks from algorithm (admin mode):', Object.keys(timeblocks));
50
+
51
+ // Apply max arrivals filter
52
+ const filtered = filterTimeblocksByMaxArrivals(restaurantData, testDate, timeblocks, reservations, guests);
53
+ console.log('\nAfter max arrivals filter:', Object.keys(filtered));
54
+
55
+ // Debug each time slot
56
+ console.log('\n--- Detailed Analysis ---');
57
+ for (const time of Object.keys(timeblocks)) {
58
+ const maxArrivalsConfig = restaurantData['max-arrivals-lunch'];
59
+ const maxArrivals = maxArrivalsConfig ? maxArrivalsConfig[time] : null;
60
+
61
+ const currentArrivals = reservations
62
+ .filter(r => r.date === testDate && r.time === time)
63
+ .reduce((sum, r) => sum + (parseInt(r.guests, 10) || 0), 0);
64
+
65
+ const isInFiltered = filtered.hasOwnProperty(time);
66
+
67
+ console.log(`\n${time}:`);
68
+ console.log(` Max arrivals setting: ${maxArrivals || 'NOT SET'}`);
69
+ console.log(` Current arrivals: ${currentArrivals}`);
70
+ console.log(` New reservation: ${guests} guests`);
71
+ console.log(` Total after adding: ${currentArrivals + guests}`);
72
+ console.log(` Passes filter: ${isInFiltered ? 'YES' : 'NO'}`);
73
+
74
+ if (maxArrivals !== null && maxArrivals !== undefined) {
75
+ console.log(` Logic: ${currentArrivals} + ${guests} = ${currentArrivals + guests} ${currentArrivals + guests <= maxArrivals ? '<=' : '>'} ${maxArrivals}`);
76
+ }
77
+ }
78
+
79
+ console.log('\n=== END TEST ===');