Fix missed trip when arrive-by search-window is off by one minute#5520
Conversation
In the current version the dynamic search-window is set 1 minute too early to include a trip if both the minimum travel time can be calculated exact, and the journey arrival-time is withing 59s of the LAT.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5520 +/- ##
=============================================
- Coverage 66.95% 66.91% -0.04%
+ Complexity 15794 15755 -39
=============================================
Files 1832 1824 -8
Lines 70540 70417 -123
Branches 7410 7403 -7
=============================================
- Hits 47229 47120 -109
+ Misses 20840 20830 -10
+ Partials 2471 2467 -4 ☔ View full report in Codecov by Sentry. |
|
I've reviewed the last commit (85994c2) as requested, it looks ok ✔️. |
Thank you for that, the base PR is now merged and I have merged dev-2.x into this PR - and as you can see this PR is now just one commit + pluss the merge. You can approve again - or if not I will just merge when I have the second approval. Thanks again for the fast approvel. |
Summary
The dynamic SearchWindow for arriveBy search is off by one minute. The searchWindow is calculated by Raptor after the heuristics is done. Raptor uses the
min-travel-time, thesearch-windowandlatest-arrival-timeto calculate theearliest-departure-time. But, the algorithm rounded themin-travel-timeup, not down to the closest minute. This causesdeparture-timeof the journey to all outside(after) the search-window - if the journey arrive within 59 seconds of thelatest-arrival-time.This is fixed by rounding down, instead of rounding up.
Issue
This fixes the bug repoted by @jtorin here.
Tests
✅ There where unit-test on this - they also was wrong. So, the test are now updated and a test on an exact journey matching the min-travel-time is added.
I have also recreated the bug reported by @jtorin and verified that this solves it. I have also adjusted the access/egress to exactly match whole minutes. This will cause the
min-travel-timeto match themissed-journey-travel-timeexact.Documentation
✅ Relevant doc is updated.
Changelog
✅ This bug has existed in OTP for a long time, but was not discovered, because a bug in the itinerary-filter failed to remove it. This bug was fixed in: #5433
Bumping the serialization version id
🟥 No needed.