Skip to content

Commit

Permalink
Merge pull request #362 from HSLdevcom/DT-4792
Browse files Browse the repository at this point in the history
Improve handling of trip updates that have SKIPPED stops but not full stop sequence
  • Loading branch information
vesameskanen authored Jun 15, 2021
2 parents f27ddf6 + c49b74e commit 891117f
Showing 1 changed file with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -873,14 +873,9 @@ private boolean handleModifiedTrip(final Graph graph, final Trip trip, final Tri

final TripPattern pattern = getPatternForTripId(feedId, trip.getId().getId());
if (pattern != null) {
if (checkNewStopTimeUpdateStopsMatchesPatten(stops, pattern)) {
// TripUpdate stop pattern matches existing trip. Handle as scheduled trip
LOG.warn("MODIFIED trip {} matches existing SCHEDULED trip. Treating as such.", trip.getId().getId());
return handleScheduledTrip(tripUpdate, feedId, serviceDate);
}
// Do not modify scheduled trips as it causes canceled trip to appear in indexes and replacement trip not added to indexes
LOG.error("MODIFIED trip {} matches existing SCHEDULED trip. Stop patterns do not match SKIPPING", trip.getId().getId());
return false;
// TripUpdate stop pattern matches existing trip. Handle as scheduled trip
LOG.warn("MODIFIED trip {} matches existing SCHEDULED trip. Treating as such.", trip.getId().getId());
return handleScheduledTrip(tripUpdate, feedId, serviceDate);
}

// Cancel scheduled trip
Expand All @@ -898,10 +893,6 @@ private boolean handleModifiedTrip(final Graph graph, final Trip trip, final Tri
return success;
}

private boolean checkNewStopTimeUpdateStopsMatchesPatten(List<Stop> stops, TripPattern pattern) {
return stops.equals(pattern.getStops());
}

private boolean handleCanceledTrip(final TripUpdate tripUpdate, final String feedId, final ServiceDate serviceDate) {
boolean success = false;
if (tripUpdate.getTrip().hasTripId()) {
Expand Down

0 comments on commit 891117f

Please sign in to comment.