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(orca-fares): remove fare attributes with no rules #6089

Conversation

daniel-heppner-ibigroup
Copy link
Contributor

Summary

ORCA agencies have occasionally left in fare attributes with no associated rules. OTP will match these against any leg, and if the fare is lower than the correct fare, it will take priority. There does not seem to be a well defined behavior for this edge case in the GTFS spec, but to avoid changing the behavior of OTP in general, I have added a one liner to remove these fare attributes lacking rules when using the ORCA fare module.

Unit tests

I'm not sure how to test this or if it's necessary, since this change happened in the ORCA fare factory which is untested.

@daniel-heppner-ibigroup daniel-heppner-ibigroup requested a review from a team as a code owner September 25, 2024 01:38
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 69.84%. Comparing base (9c10a0e) to head (54223b1).
Report is 65 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...nner/ext/fares/impl/DefaultFareServiceFactory.java 0.00% 1 Missing ⚠️
...pentripplanner/ext/fares/impl/OrcaFareFactory.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev-2.x    #6089      +/-   ##
=============================================
+ Coverage      69.82%   69.84%   +0.02%     
- Complexity     17419    17462      +43     
=============================================
  Files           1974     1974              
  Lines          74545    74606      +61     
  Branches        7633     7640       +7     
=============================================
+ Hits           52048    52107      +59     
- Misses         19847    19850       +3     
+ Partials        2650     2649       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -40,6 +40,15 @@ public Set<RouteOriginDestination> getRouteOriginDestinations() {
return routeOriginDestinations;
}

public boolean hasRules() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one needs Javadoc and a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I added tests for this and matches.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very nice test but where is the Javadoc?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

@leonardehrenfried leonardehrenfried added Sandbox IBI Developed by or important for IBI Group Skip Changelog labels Sep 25, 2024
@daniel-heppner-ibigroup daniel-heppner-ibigroup force-pushed the orca-remove-ruleless-attributes branch 2 times, most recently from f96de66 to 7cfb806 Compare September 26, 2024 20:59
@daniel-heppner-ibigroup daniel-heppner-ibigroup force-pushed the orca-remove-ruleless-attributes branch from 7cfb806 to feedefe Compare September 26, 2024 21:00
Comment on lines 138 to 139
new HashSet<>(),
new HashSet<>(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
new HashSet<>(),
new HashSet<>(),
Set.of(),
Set.of()

I find this visually a bit more pleasing. Not a big issue though.

@daniel-heppner-ibigroup daniel-heppner-ibigroup force-pushed the orca-remove-ruleless-attributes branch from 023a39b to 364cf4f Compare September 27, 2024 16:48
@daniel-heppner-ibigroup daniel-heppner-ibigroup force-pushed the orca-remove-ruleless-attributes branch from 66dbc18 to 54223b1 Compare September 27, 2024 16:54
@leonardehrenfried
Copy link
Member

Only sandbox code. Merging with a single review.

@leonardehrenfried leonardehrenfried merged commit 2fe2b37 into opentripplanner:dev-2.x Sep 30, 2024
5 checks passed
@leonardehrenfried leonardehrenfried deleted the orca-remove-ruleless-attributes branch September 30, 2024 08:49
@t2gran t2gran added this to the 2.7 (next release) milestone Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IBI Developed by or important for IBI Group Sandbox Skip Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants