-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix handling of implicit access and egress mode parameters. #5821
Fix handling of implicit access and egress mode parameters. #5821
Conversation
If the 'modes' section is present but the nested 'access' or 'egress' parameters are not, then only transit that originates from/arrives directly at the stop should be used for the trip, just as if the parameter was present and set to null. Fix this by setting the corresponding mode to NOT_SET in the cases where 'modes' is specified but the parameter is not. Adapt and add tests to cover these cases better.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5821 +/- ##
=============================================
+ Coverage 67.88% 67.91% +0.02%
- Complexity 16559 16560 +1
=============================================
Files 1908 1910 +2
Lines 72355 72437 +82
Branches 7443 7444 +1
=============================================
+ Hits 49120 49197 +77
- Misses 20714 20721 +7
+ Partials 2521 2519 -2 ☔ View full report in Codecov by Sentry. |
The behavior of #5779 is kept. I've removed the added comment though, as the default values are depending on whether the I would like to believe that the intention of #5675 is kept intact as well. If nothing else @eibakke has added nice tests on the functionality which helped a lot. 🌟 |
src/test/java/org/opentripplanner/apis/transmodel/mapping/TripRequestMapperTest.java
Show resolved
Hide resolved
src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java
Outdated
Show resolved
Hide resolved
…ogic. * Set NOT_SET early where applicable. * Rework how transferMode is applied but take care to not overwrite the defaults even if it's the same value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with a minor comment
src/main/java/org/opentripplanner/apis/transmodel/mapping/RequestModesMapper.java
Outdated
Show resolved
Hide resolved
…estModesMapper.java Replace Optional-chain with a less complicated ternary condition. Co-authored-by: Henrik Abrahamsson <[email protected]>
Summary
If the
modes
section is present but the nestedaccess
oregress
parameters are not, then only transit that originates from/arrives directly at the stop should be used for the trip, just as if the parameter was present and set to null.Fix this by setting the corresponding mode to NOT_SET in the cases where
modes
is specified but the parameter is not.This is a regression as compared to OTP 2.4.
Unit tests
Adapt and add tests to cover these cases better.
Manually verified most of the permutations of cases.