Skip to content

Method isTripActive able to check the delay cases in StopTimeUpdate#439

Open
TsimurSh wants to merge 4 commits intoOneBusAway:mainfrom
goeuropa:fix_is_trip_active_for_delay_stoptimeupdate
Open

Method isTripActive able to check the delay cases in StopTimeUpdate#439
TsimurSh wants to merge 4 commits intoOneBusAway:mainfrom
goeuropa:fix_is_trip_active_for_delay_stoptimeupdate

Conversation

@TsimurSh
Copy link
Copy Markdown

@TsimurSh TsimurSh commented Jun 5, 2025

Hi,
Please take a look at this change. Unfortunately, this method will regret all trips and mark them as inactive if the tripUpdates use a delay in the stopTimeUpdate.

isTripActive method able to check the delay cases in StopTimeUpdate
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jun 5, 2025

CLA assistant check
All committers have signed the CLA.

@aaronbrethorst
Copy link
Copy Markdown
Member

Thanks for your contribution. Can you elaborate on the scenario you’re solving for and also add tests that validate it?

@TsimurSh
Copy link
Copy Markdown
Author

Ok. I added a test.
Problems what it solve:
In normal GTFS-realtime updates, trip predictions are considered active if:

  • There’s at least one stop time update,
  • And its first and last stop predictions fall within a valid time window.
    But sometimes a TripUpdate:
  • Lacks timestamps (i.e., no arrival.time),
  • Only has a delay

The previous logic would fail in such a case because it relies on arrival/departure time values.

@aaronbrethorst Take a look at.

@aaronbrethorst aaronbrethorst requested a review from Copilot June 20, 2025 15:31
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses an issue in the Trip Library where trips with a delay (but without an arrival time) are being incorrectly marked as inactive.

  • Adds a new test (testIsTripActive_WithDelayNoTimeAndScheduledTrip) to validate that trips with a delay and scheduled status are active.
  • Exposes the isTripActive method via a new public getter (getIsTripActive) to facilitate testing.
  • Updates the isTripActive method to return true when the last stop time has a delay and no time with a scheduled trip.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
onebusaway-transit-data-federation/src/test/java/org/onebusaway/transit_data_federation/impl/realtime/gtfs_realtime/GtfsRealtimeTripLibraryTest.java Added a new unit test to validate delay without time handling for scheduled trips.
onebusaway-transit-data-federation/src/main/java/org/onebusaway/transit_data_federation/impl/realtime/gtfs_realtime/GtfsRealtimeTripLibrary.java Exposed the isTripActive method and updated its logic to check delay cases correctly.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants