-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix SIRI ET ExtraJourney trips not appearing in departure/arrival boards #7052
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 SIRI ET ExtraJourney trips not appearing in departure/arrival boards #7052
Conversation
2bf1a28 to
e2f35ad
Compare
…ealTime' for clarity
This is needed to show extra journeys (added trips) on arrival/depature boards
e2f35ad to
166e934
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #7052 +/- ##
=============================================
- Coverage 72.09% 72.06% -0.03%
- Complexity 20694 20910 +216
=============================================
Files 2244 2282 +38
Lines 83899 84466 +567
Branches 8347 8434 +87
=============================================
+ Hits 60488 60873 +385
- Misses 20482 20623 +141
- Partials 2929 2970 +41 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
You have to resolve the conflicts, I'm afraid. |
application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java
Outdated
Show resolved
Hide resolved
| if (stopPatternChangedInRealTime && !realTimeTripPattern) { | ||
| throw new IllegalStateException(); | ||
| } |
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.
I think guard statements should go at the top or next to where we set the parameters. Otherwise it is easy to miss it when reading the code.
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.
I agree, but for constructors we often do validation it at the end, or where the assignment happens. Doing it at the end has the power that you can do it on the members - not the arguments. So, if there is logic in the constructor you validate the result. In short, syntactic validation (preconditions) of input fields should be done first (or part of assignment this.a = requireNonNull(a)), semantic validation last(postconditions). This constructor follow this.
application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/transit/model/timetable/TimetableSnapshot.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/opentripplanner/transit/model/network/TripPattern.java
Show resolved
Hide resolved
| .withNetexSubmode(trip.getNetexSubMode()) | ||
| .withStopPattern(stopPattern) | ||
| .withCreatedByRealtimeUpdater(true) | ||
| .withRealTimeStopPatternChanged() |
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.
Should it be withRealTimeStopPatternChanged() in the case of a modified trip and withRealTimeAddedTrip() in the case of an added trip?
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.
This is not changed, it might be wrong - but in that case it should be fixed in a separate PR. The old code:
tripPattern = TripPattern.of(id)
:
.withCreatedByRealtimeUpdater(true)
The withCreatedByRealtimeUpdater(true) was set for all TripPatterns where the stop-pattern was modified. But, NOT if the pattern was new.
…dInRealTime for clarity
270cf7a to
3509ce3
Compare
Summary
This PR fixes a bug where extra journeys (GTFS ADDED trips / NeTEx ExtraJourney) were missing from arrival/departure boards. The root cause was that TimetableSnapshot.addPatternToIndex() was incorrectly checking if the stop pattern was modified in real-time, rather than checking if the pattern was created in real-time. This PR introduces a clearer distinction between real-time patterns with modified stop patterns (rerouted trips) and real-time patterns for completely new trips (added trips/extra journeys).
Changes
realTimeTripPattern: True for any pattern created by real-time updates (rerouted OR added)stopPatternChangedInRealTime: True only when a scheduled trip's stop pattern is modified. This is exactlythe same as the previous
createdByRealtimeUpdaterflag.TimetableSnapshot.addPatternToIndex()now usesisRealTimeTripPattern()to include all real-time patternswithRealTimeStopPatternChanged(): For rerouted trips with modified stop patternswithRealTimeAddedTrip(): For completely new trips (GTFS ADDED / NeTEx ExtraJourney)Core changes
TripPattern.java: Added dual flags, new methods, improved JavaDocTripPatternBuilder.java: New builder methods with clear semanticsTimetableSnapshot.java: Fixed index update logic (line 600)Needs more investigation
TripPattern#isStopPatternChangedInRealTime()inTransferIndexGeneratorandRealTimeRaptorTransitDataUpdatershould be investigated. It is probably better to use the more genericisRealTimeTripPattern()in these places, and than add logic for handling ADDED trips (even if that logic is just to ignore these cases). The code as is, is easy to misunderstand.Build on top of #7130
Issue
Fixes #7008
Testing
Manual Testing
I have manually tested the case documented in the issue, before and after applying the fix.
Documentation
realTimeTripPatternandstopPatternChangedInRealTimeChangelog
Bumping the serialization version id