-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
return stoptimesForDate from the schedule if it is called with no parameter on a day when the trip does not run #6480
base: dev-2.x
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6480 +/- ##
=============================================
- Coverage 70.20% 70.18% -0.02%
+ Complexity 18313 18311 -2
=============================================
Files 2080 2082 +2
Lines 77182 77194 +12
Branches 7831 7830 -1
=============================================
- Hits 54183 54178 -5
- Misses 20230 20250 +20
+ Partials 2769 2766 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…es even if the trip does not run today. Technically wrong, but UIs rely on this, and have for a long time
…explicit parameter of today
…the corresponding case with useScheduledWhenNonRunning
public Optional<List<TripTimeOnDate>> getTripTimeOnDates( | ||
Trip trip, | ||
LocalDate serviceDate, | ||
boolean useScheduledWhenNonRunning |
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.
The name of this parameter is a bit confusing as my first intuition at least is that it would use scheduled times from the given date instead of trying to use real-time when trip is cancelled, or something like that. Maybe something like fallbackToNextScheduledDate
instead.
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.
Unfortunately I think that @optionsome 's suggestion is wrong. If the service has been modified on the next date when it is scheduled to run, the method does not return the modified service.
I think a better name is to fallbackToBaseTimetable
instead.
application/src/main/java/org/opentripplanner/transit/service/TransitService.java
Outdated
Show resolved
Hide resolved
application/src/main/resources/org/opentripplanner/apis/gtfs/schema.graphqls
Outdated
Show resolved
Hide resolved
application/src/test/java/org/opentripplanner/transit/service/DefaultTransitServiceTest.java
Outdated
Show resolved
Hide resolved
…TransitService.java Co-authored-by: Joel Lappalainen <lappalj8@gmail.com>
…chema.graphqls Co-authored-by: Joel Lappalainen <lappalj8@gmail.com>
…DefaultTransitServiceTest.java Co-authored-by: Joel Lappalainen <lappalj8@gmail.com>
application/src/main/java/org/opentripplanner/transit/service/TransitService.java
Outdated
Show resolved
Hide resolved
public Optional<List<TripTimeOnDate>> getTripTimeOnDates( | ||
Trip trip, | ||
LocalDate serviceDate, | ||
boolean useScheduledWhenNonRunning |
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.
Unfortunately I think that @optionsome 's suggestion is wrong. If the service has been modified on the next date when it is scheduled to run, the method does not return the modified service.
I think a better name is to fallbackToBaseTimetable
instead.
new TripTimeOnDate(REALTIME_TRIP_TIMES, 1, REAL_TIME_PATTERN, SERVICE_DATE, midnight) | ||
) | ||
), | ||
service.getTripTimeOnDates(TRIP, SERVICE_DATE, true) |
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 you are testing for a wrong date. SERVICE_DATE
is a date the service does run, and NO_SERVICE_DATE
is a date the service does not run.
Fixes Issue #6475
Technically the solution here is wrong, but longstanding UIs (like digitransit-ui) rely on getting the scheduled timetable when running stoptimesForDate without a parameter on a wrong day.