Skip to content

Cancelling a stop with GTFS-RT fails when the scheduled stop times are repeating #6848

@leonardehrenfried

Description

@leonardehrenfried

If you have the following GTFS trip

stop arrival departure
A 10:00 10:01
B 10:01 10:01
C 10:01 10:02

which is a little odd but satisfies the GTFS spec and our internal constraints and apply a GTFS-RT trip update which SKIPs stop B, it fails with a NEGATIVE_HOP_TIME error.

That is because the stop cancellation logic assumes that the travel time between the stops is greater than zero:

int prevScheduledDeparture = builder.getScheduledDepartureTime(firstCanceledStop - 1);
int scheduledTravelTime = builder.getScheduledArrivalTime(i) - prevScheduledDeparture;
int realTimeTravelTime = arrival - prevDeparture;
double travelTimeRatio = (double) realTimeTravelTime / scheduledTravelTime;

If the travel time is zero, then travelTimeRatio becomes Infinity leading to validation errors.

cc @laurentg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions