Commit Graph

930 Commits

Author SHA1 Message Date
5f3ca479aa Specify node version in nvmrc 2025-11-14 11:02:26 -08:00
e1a389101f Merge pull request #88 from brendan-ch:hotfix/use-two-hour-windows-for-all-fallbacks
hotfix/use-two-hour-windows-for-all-fallbacks
2025-11-14 10:54:14 -08:00
8621f10721 Switch the order of fallbacks (previous 2h first)
Data from the current day is more representative of current traffic conditions than the same data from a previous day.
2025-11-14 10:49:23 -08:00
f8e7670b3f For data from last week and previous day, look back instead of looking forward 2025-11-14 10:40:37 -08:00
397eb2b588 Change one-hour windows to two hours
A set of shuttles may only make a complete set of trips in two hours, so this should capture more data when calculating ETAs.
2025-11-14 10:34:48 -08:00
b2ebd3df9c Merge pull request #87 from brendan-ch/hotfix/clear-shuttle-last-stop-if-no-data
hotfix/clear-shuttle-last-stop-if-no-data
2025-11-14 10:31:33 -08:00
f06e778b80 Implement removal of last stop data on shuttle removal 2025-11-14 10:26:52 -08:00
1511b3c118 Add test case to check that last stop data is removed 2025-11-14 10:23:02 -08:00
f76126c951 Implement clearing of last stop data 2025-11-14 10:19:15 -08:00
4523badea9 Test that clearShuttleData also clears last stop data 2025-11-14 10:17:33 -08:00
05fc03c032 Merge pull request #86 from brendan-ch/feat/self-calculated-etas
feat/self-calculated-etas
2025-11-13 22:38:51 -08:00
a89d3c7ae3 Fix test references 2025-11-13 22:36:13 -08:00
6278d695fa Add support back in for external source ETA repositories, if we switch back later 2025-11-13 22:28:07 -08:00
b74a0d5d64 Restrict stop arrival event to only next stop after shuttle's last stop, if last stop exists 2025-11-13 22:13:17 -08:00
2df8f389b3 Change the final fallback window to two hours 2025-11-13 20:23:14 -08:00
f9ed8f16ac Bind methods and log errors for missing keys 2025-11-13 20:08:15 -08:00
d6ad90ee7a Change SHUTTLE_WILL_ARRIVE_AT_STOP to return payload of last stop and current stop, to avoid data race 2025-11-13 18:52:13 -08:00
0cf2a4d2e7 Add logic to clear out previous ETAs 2025-11-13 18:35:20 -08:00
2fbc13202d Apply the same changes to the in-memory repository 2025-11-13 18:02:10 -08:00
bf6a2e4667 Add recursive implementation of cascading ETA updates for multiple ordered stops 2025-11-13 17:38:53 -08:00
91584fc2ab Extract fallback logic to a separate method 2025-11-13 17:19:37 -08:00
42c71815e6 Make the ETA assertion check for multiple ETA insertions 2025-11-13 17:13:43 -08:00
e4151ed914 Return stop3 as part of the test data 2025-11-13 17:08:47 -08:00
f95263eec8 Add another stop and ordered stop to the test data 2025-11-13 17:07:28 -08:00
b5690d8983 Also implement the fallback logic in the in-memory repository 2025-11-13 16:52:39 -08:00
076f1fd1e4 Extract setup and assertion procedure into method for all three tests to use 2025-11-13 16:49:32 -08:00
71ac18cb8d Add a similar test for previous hour 2025-11-13 16:43:53 -08:00
3f267be154 Add test for previous day fallback calculation 2025-11-13 16:41:51 -08:00
d302e8a2cb Reorganize self-updating repository tests based on method name 2025-11-13 16:07:42 -08:00
7463cb27f1 Add proof-of-concept which also queries same time period yesterday, as well as last hour 2025-11-11 21:41:32 -08:00
1866224b5b Prevent shuttle arriving at same stop from firing the SHUTTLE_WILL_ARRIVE_AT_STOP event 2025-11-11 21:22:39 -08:00
4096c0ce44 Add call to startListeningForUpdates() 2025-11-11 21:05:43 -08:00
97feec6d3f Connect etaRepository to Redis in the builder 2025-11-11 20:47:20 -08:00
e03e962ab9 Implement remaining logic for RedisExternalSourceETARepository 2025-11-11 20:24:55 -08:00
6a31609960 Implement in-memory equivalents of both ETA repositories 2025-11-11 20:21:40 -08:00
7c5aeda4a9 Add timeouts for event emitters, and update reference behavior for the ETA entry test 2025-11-11 20:11:45 -08:00
ac81806b26 Swap implementations of two handler methods, and add reference implementation for adding travel time data 2025-11-11 19:51:31 -08:00
88a393c1ad Update ETA add test to use setReferenceTime 2025-11-11 19:41:42 -08:00
5e8a3c84a6 Add previous reference implementation of getAverageTravelTimeSeconds and method bindings 2025-11-11 19:41:19 -08:00
4b37f3a121 Add a helper method for setting the "reference time" of the self-updating repo 2025-11-11 19:34:05 -08:00
e8f4e7b9ee Add a base protected method for adding ETAs and emitting events 2025-11-11 19:33:52 -08:00
9af50ddfe9 Change the event name to SHUTTLE_WILL_ARRIVE_AT_STOP, and emit it before the stop is updated 2025-11-11 19:10:13 -08:00
b9fefcc6a9 Implement BaseRedisETARepository based on past implementation 2025-11-11 19:05:47 -08:00
04e8354e05 Implement BaseInMemoryETARepository based on previous implementation in shuttle repository 2025-11-11 19:03:16 -08:00
bc7ba7d507 Subscribe to shuttle events and add stub methods 2025-11-11 18:56:46 -08:00
6cf61d1cdb Unify eventual getter implementations in a BaseRedisETARepository class 2025-11-11 18:47:13 -08:00
7497c1d004 Apply the same events to UnoptimizedInMemoryShuttleRepository 2025-11-11 18:39:24 -08:00
a3bfa4894e Fix date type mismatch for data comparison 2025-11-11 18:35:13 -08:00
992a2b6149 Implement the events 2025-11-11 18:34:17 -08:00
5b1c5897fc Re-apply event emitter tests for the new shuttle events 2025-11-11 16:53:27 -08:00