Skip to content

Commit

Permalink
Reset pattern back to original if trip not found in realtime generate…
Browse files Browse the repository at this point in the history
…d pattern
  • Loading branch information
hannesj committed Jan 12, 2022
1 parent e2e8f39 commit 81abb7d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/main/java/org/opentripplanner/model/Timetable.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ public int getTripIndex(FeedScopedId tripId) {
if (tt.getTrip().getId().equals(tripId)) { return ret; }
ret += 1;
}
LOG.warn("TripId {} not found in Timetable for pattern {} on {}, with {} tripTimes",
tripId, pattern.getId(), serviceDate, tripTimes.size()
);
return -1;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public static List<TripTimeOnDate> getTripTimesShort(RoutingService routingServi
pattern = routingService.getPatternForTrip().get(trip);
}
timetable = timetableSnapshot.resolve(pattern, serviceDate);

// If realtime moved pattern back to original trip, fetch it instead
if (timetable.getTripIndex(trip.getId()) == -1) {
pattern = routingService.getPatternForTrip().get(trip);
timetable = timetableSnapshot.resolve(pattern, serviceDate);
}
}
if (timetable == null) {
timetable = routingService.getPatternForTrip().get(trip).getScheduledTimetable();
Expand Down

0 comments on commit 81abb7d

Please sign in to comment.