Skip to content

Commit

Permalink
DPO-2417 use SKIPPED for past stops
Browse files Browse the repository at this point in the history
  • Loading branch information
teijosol committed Jan 11, 2024
1 parent 5b07ba4 commit 5ebb553
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private GtfsRealtime.TripUpdate.StopTimeUpdate.Builder createStop(final int stop
.setStopSequence(stopSequence);
}

private boolean isSkipped(final GTFSTimeTableRow arrival, final GTFSTimeTableRow departure) {
private boolean isCancelled(final GTFSTimeTableRow arrival, final GTFSTimeTableRow departure) {
if(departure != null) {
return departure.cancelled;
}
Expand All @@ -146,18 +146,18 @@ private boolean isSkipped(final GTFSTimeTableRow arrival, final GTFSTimeTableRow
return arrival != null && arrival.cancelled;
}
private GtfsRealtime.TripUpdate.StopTimeUpdate createStopTimeUpdate(final int stopSequence, final GTFSTimeTableRow arrival, final GTFSTimeTableRow departure) {
// it's in the past(PAST_LIMIT_MINUTES), don't report it!
if(isInThePast(arrival, departure)) {
return null;
}

// setting cancelled stops as SKIPPED
if(isSkipped(arrival, departure)) {
if(isCancelled(arrival, departure)) {
return createStop(stopSequence, arrival, departure)
.setScheduleRelationship(GtfsRealtime.TripUpdate.StopTimeUpdate.ScheduleRelationship.SKIPPED)
.build();
}

// it's in the past(PAST_LIMIT_MINUTES), don't report it!
if(isInThePast(arrival, departure)) {
return null;
}

final boolean arrivalHasTime = arrival != null && arrival.hasEstimateOrActualTime();
final boolean departureHasTime = departure != null && departure.hasEstimateOrActualTime();

Expand Down Expand Up @@ -270,7 +270,7 @@ private List<GtfsRealtime.TripUpdate.StopTimeUpdate> createStopTimeUpdates(final

private boolean includeStop(final GTFSTimeTableRow arrival, final GTFSTimeTableRow departure) {

// include only stops where scheduled times are different and stop is commercial
// include only stops where scheduled times are different and stop is commercial(either arrival or departure)
return departure == null || (!arrival.scheduledTime.equals(departure.scheduledTime) &&
(isTrue(arrival.commercialStop) || isTrue(departure.commercialStop)));
}
Expand Down

0 comments on commit 5ebb553

Please sign in to comment.