Skip to content
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

Conversation

jtorin
Copy link
Contributor

@jtorin jtorin commented Apr 25, 2024

Summary

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.

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.

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.
@jtorin jtorin requested a review from a team as a code owner April 25, 2024 09:09
@jtorin jtorin added the Skanetrafiken On skanetrafikens roadmap label Apr 25, 2024
Copy link

codecov bot commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.91%. Comparing base (aa92132) to head (7b07cd5).
Report is 26 commits behind head on dev-2.x.

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.
📢 Have feedback on the report? Share it here.

@t2gran t2gran added this to the 2.6 (next release) milestone Apr 25, 2024
@vpaturet
Copy link
Contributor

see also #5779 and #5675

@t2gran t2gran requested a review from vpaturet April 25, 2024 13:44
@jtorin
Copy link
Contributor Author

jtorin commented Apr 25, 2024

see also #5779 and #5675

The behavior of #5779 is kept. I've removed the added comment though, as the default values are depending on whether the modes section is present or not, as well if the parameters are set to null. 😕

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. 🌟

vpaturet
vpaturet previously approved these changes Apr 30, 2024
jtorin added 2 commits May 6, 2024 14:00
…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.
Copy link
Contributor

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

…estModesMapper.java


Replace Optional-chain with a less complicated ternary condition.

Co-authored-by: Henrik Abrahamsson <[email protected]>
@jtorin jtorin merged commit 06c9160 into opentripplanner:dev-2.x May 10, 2024
5 checks passed
@jtorin jtorin deleted the correct-implicit-access-egress-modes-handling branch May 10, 2024 10:03
t2gran pushed a commit that referenced this pull request May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skanetrafiken On skanetrafikens roadmap
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants