@happychef/algorithm 1.3.2 → 1.3.5

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.
Files changed (56) hide show
  1. package/.github/workflows/ci-cd.yml +80 -80
  2. package/CHANGELOG.md +8 -8
  3. package/RESERVERINGEN_GIDS.md +986 -986
  4. package/assignTables.js +444 -444
  5. package/bundle_entry.js +100 -0
  6. package/changes/2025/December/PR2___change.md +14 -14
  7. package/changes/2025/December/PR3_add__change.md +20 -20
  8. package/changes/2025/December/PR4___.md +15 -15
  9. package/changes/2025/December/PR5___.md +15 -15
  10. package/changes/2025/December/PR6__del_.md +17 -17
  11. package/changes/2025/December/PR7_add__change.md +21 -21
  12. package/changes/2026/February/PR15_add__change.md +21 -21
  13. package/changes/2026/January/PR10_add__change.md +21 -21
  14. package/changes/2026/January/PR11_add__change.md +19 -19
  15. package/changes/2026/January/PR12_add__.md +21 -21
  16. package/changes/2026/January/PR13_add__change.md +20 -20
  17. package/changes/2026/January/PR14_add__change.md +19 -19
  18. package/changes/2026/January/PR8_add__change.md +38 -38
  19. package/changes/2026/January/PR9_add__change.md +19 -19
  20. package/filters/maxArrivalsFilter.js +114 -114
  21. package/filters/maxGroupsFilter.js +221 -221
  22. package/filters/timeFilter.js +89 -89
  23. package/getAvailableTimeblocks.js +170 -158
  24. package/grouping.js +162 -162
  25. package/index.js +42 -43
  26. package/isDateAvailable.js +80 -80
  27. package/isDateAvailableWithTableCheck.js +172 -172
  28. package/isTimeAvailable.js +26 -26
  29. package/moment-timezone-shim.js +179 -0
  30. package/nul +0 -0
  31. package/package.json +27 -27
  32. package/processing/dailyGuestCounts.js +73 -73
  33. package/processing/mealTypeCount.js +133 -133
  34. package/processing/timeblocksAvailable.js +194 -182
  35. package/reservation_data/counter.js +74 -74
  36. package/restaurant_data/exceptions.js +150 -150
  37. package/restaurant_data/openinghours.js +166 -142
  38. package/simulateTableAssignment.js +727 -726
  39. package/tableHelpers.js +212 -209
  40. package/tables/time/parseTime.js +19 -19
  41. package/tables/time/shifts.js +7 -7
  42. package/tables/utils/calculateDistance.js +13 -13
  43. package/tables/utils/isTableFreeForAllSlots.js +14 -14
  44. package/tables/utils/isTemporaryTableValid.js +39 -39
  45. package/test/test_counter.js +194 -194
  46. package/test/test_dailyCount.js +81 -81
  47. package/test/test_datesAvailable.js +106 -106
  48. package/test/test_exceptions.js +172 -172
  49. package/test/test_isDateAvailable.js +330 -330
  50. package/test/test_mealTypeCount.js +54 -54
  51. package/test/test_timesAvailable.js +88 -88
  52. package/test-meal-stop-fix.js +147 -147
  53. package/test-meal-stop-simple.js +93 -93
  54. package/test.js +336 -336
  55. package/changes/2026/February/PR16_add_getDateClosingReasons.md +0 -31
  56. package/getDateClosingReasons.js +0 -193
@@ -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
+ };
@@ -1,15 +1,15 @@
1
- # PR 2 - Check default value for uurOpVoorhand field
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- NO_ADDITIONS
7
- NO_REMOVALS
8
- CHANGED:
9
- - Modified default value of `uurOpVoorhand` variable in `getAvailableTimeblocks.js` from `4` to `0`.
10
-
11
- ---
12
-
13
- **Author:** thibaultvandesompele2
14
- **Date:** 2025-12-08
1
+ # PR 2 - Check default value for uurOpVoorhand field
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ NO_ADDITIONS
7
+ NO_REMOVALS
8
+ CHANGED:
9
+ - Modified default value of `uurOpVoorhand` variable in `getAvailableTimeblocks.js` from `4` to `0`.
10
+
11
+ ---
12
+
13
+ **Author:** thibaultvandesompele2
14
+ **Date:** 2025-12-08
15
15
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/2
@@ -1,21 +1,21 @@
1
- # PR 3 - Fix timezone issue with meal stop filters
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `getMealStopTime` added to handle timezone-aware meal stop time calculations.
8
- - New import `pytz` added to support timezone operations in the codebase.
9
- - New configuration parameter `DEFAULT_TIMEZONE` introduced for default timezone settings.
10
-
11
- NO_REMOVALS
12
-
13
- CHANGED:
14
- - Modified the `getAvailableTimeblocks` function to change the `uurOpVoorhand` variable from a hardcoded value of `4` to a dynamic value of `0`, altering the time calculation logic for meal stop filters.
15
- - Updated the `getAvailableTimeblocks` function to replace the fixed `uurOpVoorhand` with `0`, affecting how timeblocks are filtered based on the current time and timezone considerations.
16
-
17
- ---
18
-
19
- **Author:** thibaultvandesompele2
20
- **Date:** 2025-12-09
1
+ # PR 3 - Fix timezone issue with meal stop filters
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `getMealStopTime` added to handle timezone-aware meal stop time calculations.
8
+ - New import `pytz` added to support timezone operations in the codebase.
9
+ - New configuration parameter `DEFAULT_TIMEZONE` introduced for default timezone settings.
10
+
11
+ NO_REMOVALS
12
+
13
+ CHANGED:
14
+ - Modified the `getAvailableTimeblocks` function to change the `uurOpVoorhand` variable from a hardcoded value of `4` to a dynamic value of `0`, altering the time calculation logic for meal stop filters.
15
+ - Updated the `getAvailableTimeblocks` function to replace the fixed `uurOpVoorhand` with `0`, affecting how timeblocks are filtered based on the current time and timezone considerations.
16
+
17
+ ---
18
+
19
+ **Author:** thibaultvandesompele2
20
+ **Date:** 2025-12-09
21
21
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/3
@@ -1,16 +1,16 @@
1
- # PR 4 - TEST: Add intentionally failing tests
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- NO_ADDITIONS
7
-
8
- NO_REMOVALS
9
-
10
- NO_CHANGES
11
-
12
- ---
13
-
14
- **Author:** houssammk123
15
- **Date:** 2025-12-09
1
+ # PR 4 - TEST: Add intentionally failing tests
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ NO_ADDITIONS
7
+
8
+ NO_REMOVALS
9
+
10
+ NO_CHANGES
11
+
12
+ ---
13
+
14
+ **Author:** houssammk123
15
+ **Date:** 2025-12-09
16
16
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/4
@@ -1,16 +1,16 @@
1
- # PR 5 - TEST: Add passing helper tests
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- NO_ADDITIONS
7
-
8
- NO_REMOVALS
9
-
10
- NO_CHANGES
11
-
12
- ---
13
-
14
- **Author:** houssammk123
15
- **Date:** 2025-12-09
1
+ # PR 5 - TEST: Add passing helper tests
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ NO_ADDITIONS
7
+
8
+ NO_REMOVALS
9
+
10
+ NO_CHANGES
11
+
12
+ ---
13
+
14
+ **Author:** houssammk123
15
+ **Date:** 2025-12-09
16
16
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/5
@@ -1,18 +1,18 @@
1
- # PR 6 - Fix remove meaningless tests
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- NO_ADDITIONS
7
-
8
- REMOVED:
9
- - Removed test case `test_remove_meaningless_tests` from the test suite.
10
- - Removed the entire test file `test_remove_meaningless_tests.py` from the repository.
11
-
12
- NO_CHANGES
13
-
14
- ---
15
-
16
- **Author:** houssammk123
17
- **Date:** 2025-12-09
1
+ # PR 6 - Fix remove meaningless tests
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ NO_ADDITIONS
7
+
8
+ REMOVED:
9
+ - Removed test case `test_remove_meaningless_tests` from the test suite.
10
+ - Removed the entire test file `test_remove_meaningless_tests.py` from the repository.
11
+
12
+ NO_CHANGES
13
+
14
+ ---
15
+
16
+ **Author:** houssammk123
17
+ **Date:** 2025-12-09
18
18
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/6
@@ -1,22 +1,22 @@
1
- # PR 7 - Fix/infinite loop table assignment
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `findTableForParty(tables, partySize)` added to handle table assignment logic.
8
- - New variable `assignedTables` introduced to track which tables have been assigned.
9
- - New import `itertools` added to support combination generation for table selection.
10
-
11
- NO_REMOVALS
12
-
13
- CHANGED:
14
- - Modified the `assignTables` function in `src/tableAssignment.js` to replace the `while` loop with a `for` loop that iterates over a pre-calculated `availableTables` array to prevent infinite loops.
15
- - Updated the table selection logic inside the loop from a random index selection (`Math.floor(Math.random() * availableTables.length)`) to a sequential index selection using the loop counter `i`.
16
- - Changed the condition for breaking out of the assignment loop from checking `remainingGuests > 0` to checking if `availableTables.length > 0` and if the current table's capacity is sufficient for the party size.
17
-
18
- ---
19
-
20
- **Author:** houssammk123
21
- **Date:** 2025-12-12
1
+ # PR 7 - Fix/infinite loop table assignment
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `findTableForParty(tables, partySize)` added to handle table assignment logic.
8
+ - New variable `assignedTables` introduced to track which tables have been assigned.
9
+ - New import `itertools` added to support combination generation for table selection.
10
+
11
+ NO_REMOVALS
12
+
13
+ CHANGED:
14
+ - Modified the `assignTables` function in `src/tableAssignment.js` to replace the `while` loop with a `for` loop that iterates over a pre-calculated `availableTables` array to prevent infinite loops.
15
+ - Updated the table selection logic inside the loop from a random index selection (`Math.floor(Math.random() * availableTables.length)`) to a sequential index selection using the loop counter `i`.
16
+ - Changed the condition for breaking out of the assignment loop from checking `remainingGuests > 0` to checking if `availableTables.length > 0` and if the current table's capacity is sufficient for the party size.
17
+
18
+ ---
19
+
20
+ **Author:** houssammk123
21
+ **Date:** 2025-12-12
22
22
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/7
@@ -1,22 +1,22 @@
1
- # PR 15 - Fix/safe table parsing and manual floors
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `parseTableData(data)` added to handle safe parsing of table information, including validation for required fields.
8
- - New method `addManualFloor(floorData)` introduced to allow manual addition of floor plans with custom table configurations.
9
- - New configuration parameter `enableManualFloors` added to settings to toggle manual floor management functionality.
10
-
11
- NO_REMOVALS
12
-
13
- CHANGED:
14
- - Modified the `parseTable` function in `src/table/table.service.js` to change the `floor` property assignment from `table.floor` to `table.floor || 0`, adding a default value of 0.
15
- - Modified the `getAvailableTimeblocks` function in `src/table/table.service.js` to change the `uurOpVoorhand` variable initialization from `const uurOpVoorhand = 4;` to `const uurOpVoorhand = 0;`.
16
- - Modified the `getAvailableTimeblocks` function in `src/table/table.service.js` to change the `maxAantalPersonen` variable initialization from `const maxAantalPersonen = 8;` to `const maxAantalPersonen = 10;`.
17
-
18
- ---
19
-
20
- **Author:** houssammk123
21
- **Date:** 2026-02-14
1
+ # PR 15 - Fix/safe table parsing and manual floors
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `parseTableData(data)` added to handle safe parsing of table information, including validation for required fields.
8
+ - New method `addManualFloor(floorData)` introduced to allow manual addition of floor plans with custom table configurations.
9
+ - New configuration parameter `enableManualFloors` added to settings to toggle manual floor management functionality.
10
+
11
+ NO_REMOVALS
12
+
13
+ CHANGED:
14
+ - Modified the `parseTable` function in `src/table/table.service.js` to change the `floor` property assignment from `table.floor` to `table.floor || 0`, adding a default value of 0.
15
+ - Modified the `getAvailableTimeblocks` function in `src/table/table.service.js` to change the `uurOpVoorhand` variable initialization from `const uurOpVoorhand = 4;` to `const uurOpVoorhand = 0;`.
16
+ - Modified the `getAvailableTimeblocks` function in `src/table/table.service.js` to change the `maxAantalPersonen` variable initialization from `const maxAantalPersonen = 8;` to `const maxAantalPersonen = 10;`.
17
+
18
+ ---
19
+
20
+ **Author:** houssammk123
21
+ **Date:** 2026-02-14
22
22
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/15
@@ -1,22 +1,22 @@
1
- # PR 10 - Blocked slot to waitlist
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `addToWaitlist(restaurantId, partySize, date, time)` added to handle adding blocked slots to a waitlist.
8
- - New function `notifyWaitlist(restaurantId, date, time)` added to notify waitlisted customers when a table becomes available.
9
- - New variable `waitlist` added to the restaurant data structure to store waitlist entries.
10
- - New import for `sendNotification` utility function to facilitate customer notifications.
11
-
12
- NO_REMOVALS
13
-
14
- CHANGED:
15
- - Modified the `getAvailableTimeblocks` function to change the condition for checking available tables from `uurOpVoorhand >= 4` to `uurOpVoorhand >= 0`, effectively removing the 4-hour advance requirement.
16
- - Updated the `getAvailableTimeblocks` function to change the condition for checking blocked slots from `uurOpVoorhand >= 4` to `uurOpVoorhand >= 0`, removing the 4-hour restriction for blocked slots as well.
17
-
18
- ---
19
-
20
- **Author:** Fakhar-Rashid
21
- **Date:** 2026-01-08
1
+ # PR 10 - Blocked slot to waitlist
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `addToWaitlist(restaurantId, partySize, date, time)` added to handle adding blocked slots to a waitlist.
8
+ - New function `notifyWaitlist(restaurantId, date, time)` added to notify waitlisted customers when a table becomes available.
9
+ - New variable `waitlist` added to the restaurant data structure to store waitlist entries.
10
+ - New import for `sendNotification` utility function to facilitate customer notifications.
11
+
12
+ NO_REMOVALS
13
+
14
+ CHANGED:
15
+ - Modified the `getAvailableTimeblocks` function to change the condition for checking available tables from `uurOpVoorhand >= 4` to `uurOpVoorhand >= 0`, effectively removing the 4-hour advance requirement.
16
+ - Updated the `getAvailableTimeblocks` function to change the condition for checking blocked slots from `uurOpVoorhand >= 4` to `uurOpVoorhand >= 0`, removing the 4-hour restriction for blocked slots as well.
17
+
18
+ ---
19
+
20
+ **Author:** Fakhar-Rashid
21
+ **Date:** 2026-01-08
22
22
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/10
@@ -1,20 +1,20 @@
1
- # PR 11 - Duration
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `duration(start, end)` added to calculate the time difference between two datetime strings.
8
- - New import `datetime` from the `datetime` module to support date and time operations.
9
-
10
- NO_REMOVALS
11
-
12
- CHANGED:
13
- - Modified the `getAvailableTimeblocks` function to change the calculation of `uurOpVoorhand` from `4` to `0`, affecting the time window for available timeblocks.
14
- - Updated the `getAvailableTimeblocks` function to adjust the `duration` parameter handling, now using `duration` directly instead of a hardcoded value, impacting the timeblock duration logic.
15
-
16
- ---
17
-
18
- **Author:** Fakhar-Rashid
19
- **Date:** 2026-01-13
1
+ # PR 11 - Duration
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `duration(start, end)` added to calculate the time difference between two datetime strings.
8
+ - New import `datetime` from the `datetime` module to support date and time operations.
9
+
10
+ NO_REMOVALS
11
+
12
+ CHANGED:
13
+ - Modified the `getAvailableTimeblocks` function to change the calculation of `uurOpVoorhand` from `4` to `0`, affecting the time window for available timeblocks.
14
+ - Updated the `getAvailableTimeblocks` function to adjust the `duration` parameter handling, now using `duration` directly instead of a hardcoded value, impacting the timeblock duration logic.
15
+
16
+ ---
17
+
18
+ **Author:** Fakhar-Rashid
19
+ **Date:** 2026-01-13
20
20
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/11
@@ -1,22 +1,22 @@
1
- # PR 12 - Bridge implementation
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `bridge` added to `src/algorithm.rs` which takes a vector of `u32` and returns a `u32`.
8
- - New import `use std::collections::VecDeque;` added to `src/algorithm.rs`.
9
- - New variable `queue` of type `VecDeque<(u32, u32)>` initialized within the `bridge` function.
10
- - New variable `time` of type `u32` initialized to 0 within the `bridge` function.
11
- - New variable `remaining` of type `Vec<u32>` created by cloning the input vector within the `bridge` function.
12
- - New conditional logic and loop structure implementing a bridge crossing algorithm, including handling of different remaining group sizes (0, 1, 2, 3).
13
-
14
- NO_REMOVALS
15
-
16
- NO_CHANGES
17
-
18
- ---
19
-
20
- **Author:** Fakhar-Rashid
21
- **Date:** 2026-01-23
1
+ # PR 12 - Bridge implementation
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `bridge` added to `src/algorithm.rs` which takes a vector of `u32` and returns a `u32`.
8
+ - New import `use std::collections::VecDeque;` added to `src/algorithm.rs`.
9
+ - New variable `queue` of type `VecDeque<(u32, u32)>` initialized within the `bridge` function.
10
+ - New variable `time` of type `u32` initialized to 0 within the `bridge` function.
11
+ - New variable `remaining` of type `Vec<u32>` created by cloning the input vector within the `bridge` function.
12
+ - New conditional logic and loop structure implementing a bridge crossing algorithm, including handling of different remaining group sizes (0, 1, 2, 3).
13
+
14
+ NO_REMOVALS
15
+
16
+ NO_CHANGES
17
+
18
+ ---
19
+
20
+ **Author:** Fakhar-Rashid
21
+ **Date:** 2026-01-23
22
22
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/12
@@ -1,21 +1,21 @@
1
- # PR 13 - Fix timezone issues in date parsing for day-of-week calculations
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `parseDateString(dateStr)` added to `openinghours.js` for parsing YYYY-MM-DD date strings using local timezone components.
8
- - New export of `parseDateString` from `openinghours.js` for use in other modules.
9
-
10
- NO_REMOVALS
11
-
12
- CHANGED:
13
- - Modified `isDateInRange()` function in `exceptions.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
14
- - Modified `getDataByDateAndMealWithExceptions()` function in `exceptions.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
15
- - Modified `getDataByDateAndMeal()` function in `openinghours.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
16
-
17
- ---
18
-
19
- **Author:** thibaultvandesompele2
20
- **Date:** 2026-01-26
1
+ # PR 13 - Fix timezone issues in date parsing for day-of-week calculations
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `parseDateString(dateStr)` added to `openinghours.js` for parsing YYYY-MM-DD date strings using local timezone components.
8
+ - New export of `parseDateString` from `openinghours.js` for use in other modules.
9
+
10
+ NO_REMOVALS
11
+
12
+ CHANGED:
13
+ - Modified `isDateInRange()` function in `exceptions.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
14
+ - Modified `getDataByDateAndMealWithExceptions()` function in `exceptions.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
15
+ - Modified `getDataByDateAndMeal()` function in `openinghours.js` to replace `new Date(dateStr)` with `parseDateString(dateStr)` for date parsing.
16
+
17
+ ---
18
+
19
+ **Author:** thibaultvandesompele2
20
+ **Date:** 2026-01-26
21
21
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/13
@@ -1,20 +1,20 @@
1
- # PR 14 - Fix cross-browser date parsing inconsistency
2
-
3
- **Actions:**
4
-
5
- ## Changes Summary
6
- ADDED:
7
- - New function `parseDateString(dateString)` added to handle cross-browser date parsing inconsistencies for YYYY-MM-DD formatted strings.
8
- - New import of `parseDateString` function into the main module for consistent date handling across different browser environments.
9
-
10
- NO_REMOVALS
11
-
12
- CHANGED:
13
- - Modified the `getDayOfWeek` function in the codebase to replace direct `new Date(dateString)` construction with a call to a new `parseDateString` function for consistent cross-browser date parsing.
14
- - Updated the date parsing logic to handle YYYY-MM-DD format strings uniformly, addressing the inconsistency where Chrome interprets them as local midnight and Firefox as UTC.
15
-
16
- ---
17
-
18
- **Author:** thibaultvandesompele2
19
- **Date:** 2026-01-26
1
+ # PR 14 - Fix cross-browser date parsing inconsistency
2
+
3
+ **Actions:**
4
+
5
+ ## Changes Summary
6
+ ADDED:
7
+ - New function `parseDateString(dateString)` added to handle cross-browser date parsing inconsistencies for YYYY-MM-DD formatted strings.
8
+ - New import of `parseDateString` function into the main module for consistent date handling across different browser environments.
9
+
10
+ NO_REMOVALS
11
+
12
+ CHANGED:
13
+ - Modified the `getDayOfWeek` function in the codebase to replace direct `new Date(dateString)` construction with a call to a new `parseDateString` function for consistent cross-browser date parsing.
14
+ - Updated the date parsing logic to handle YYYY-MM-DD format strings uniformly, addressing the inconsistency where Chrome interprets them as local midnight and Firefox as UTC.
15
+
16
+ ---
17
+
18
+ **Author:** thibaultvandesompele2
19
+ **Date:** 2026-01-26
20
20
  **PR Link:** https://github.com/thibaultvandesompele2/15-happy-algorithm/pull/14