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

Open
wants to merge 11 commits into
base: dev-2.x
Choose a base branch
from

Conversation

tkalvas
Copy link
Contributor

@tkalvas tkalvas commented Feb 21, 2025

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.

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 6 lines in your changes missing coverage. Please review.

Project coverage is 70.18%. Comparing base (04fadbf) to head (362627a).
Report is 30 commits behind head on dev-2.x.

Files with missing lines Patch % Lines
...ipplanner/apis/gtfs/datafetchers/StoptimeImpl.java 33.33% 2 Missing ⚠️
...entripplanner/apis/gtfs/datafetchers/TripImpl.java 50.00% 1 Missing and 1 partial ⚠️
...planner/transit/service/DefaultTransitService.java 71.42% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@optionsome optionsome added Regression This feature is no longer working. Digitransit Test Feature is under testing in Digitransit environment(s) labels Feb 27, 2025
…es even if the trip does not run today. Technically wrong, but UIs rely on this, and have for a long time
@tkalvas tkalvas marked this pull request as ready for review March 4, 2025 09:00
@tkalvas tkalvas marked this pull request as draft March 4, 2025 09:35
@tkalvas tkalvas marked this pull request as ready for review March 4, 2025 10:45
@tkalvas tkalvas changed the title return stoptimesForDate even if the trip does not run on the date it is queried return stoptimesForDate from the schedule if it is called with no parameter on a day when the trip does not run Mar 4, 2025
@optionsome optionsome self-requested a review March 6, 2025 10:52
public Optional<List<TripTimeOnDate>> getTripTimeOnDates(
Trip trip,
LocalDate serviceDate,
boolean useScheduledWhenNonRunning
Copy link
Member

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.

Copy link
Contributor

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.

tkalvas and others added 4 commits March 6, 2025 15:21
…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>
@tkalvas tkalvas requested a review from optionsome March 6, 2025 13:26
public Optional<List<TripTimeOnDate>> getTripTimeOnDates(
Trip trip,
LocalDate serviceDate,
boolean useScheduledWhenNonRunning
Copy link
Contributor

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)
Copy link
Contributor

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Digitransit Test Feature is under testing in Digitransit environment(s) Regression This feature is no longer working.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants