Add replacement mode filter to the GTFS API's planConnection query#7437
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7437 +/- ##
=============================================
- Coverage 71.32% 71.29% -0.04%
- Complexity 21018 21171 +153
=============================================
Files 2339 2360 +21
Lines 86908 87670 +762
Branches 8605 8681 +76
=============================================
+ Hits 61991 62507 +516
- Misses 21919 22145 +226
- Partials 2998 3018 +20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
We hope to have a feature to filter by intercity train / suburban train. Will this have any effect in the design? |
|
Jessica also wants filtering somewhat like that. I think these can be added easily, when we figure out how to map from netex submodes/extended gtfs types to the features we actually want to filter on, because the consensus was that we don't want to filter by them directly. |
optionsome
left a comment
There was a problem hiding this comment.
You could also update some existing GraphQL integration test. I've forgotten the reason why we do the replacement mapping on the API side instead of when we construct the routes/trips. The filtering would probably be a bit more efficient if we stored the information about a trip/route being a replacement in their data structures.
|
|
||
| public MainAndSubMode toMainAndSubMode() { | ||
| if (this.replacement != null) { | ||
| throw new IllegalArgumentException("Not convertible to MainAndSubMode"); |
There was a problem hiding this comment.
Not sure what is the correct exception here.
There was a problem hiding this comment.
Yeah, me neither. But I think we should check invariants and throw exceptions more.
Summary
Implementation to address issue #7270
Add boolean "replacement" to PlanTransitModePreferenceInput which makes it possible to select (for example) just the buses which are not replacements, or just the buses which are replacements, when filtering possible transit modes for planConnection.
I'm not that sure about the naming of NarrowedTransitMode, but couldn't come up with a good name. (I also intended it to have the explicit gtfs extended type lists, but that idea was discarded by an OTP dev meeting).
Unit tests
Had to adjust a couple of tests.
Unit test for the added functionality still missing, necessary for approval.
Documentation
No changes.
Changelog
Yes.
Bumping the serialization version id
No.