Skip to content

Commit 2bf1a28

Browse files
committed
fix: SIRI ET ExtraJourney trips not appearing in departure/arrival boards
1 parent 86b5333 commit 2bf1a28

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

application/src/main/java/org/opentripplanner/model/TimetableSnapshot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,12 @@ private boolean clearEntriesForRealtimeAddedTrips(String feedId) {
606606
}
607607

608608
/**
609-
* Add the patterns to the stop index, only if they come from a modified pattern
609+
* Add patterns to the stop index for patterns created by realtime updaters.
610+
* This ensures that realtime-added trips (like SIRI ET ExtraJourneys) appear in
611+
* departure board queries at stops.
610612
*/
611613
private void addPatternToIndex(TripPattern tripPattern) {
612614
if (tripPattern.isCreatedByRealtimeUpdater()) {
613-
//TODO - SIRI: Add pattern to index?
614-
615615
for (var stop : tripPattern.getStops()) {
616616
patternsForStop.put(stop, tripPattern);
617617
}

application/src/main/java/org/opentripplanner/updater/trip/siri/AddedTripBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ Result<TripUpdate, UpdateError> build() {
233233
.withNetexSubmode(trip.getNetexSubMode())
234234
.withStopPattern(stopPattern)
235235
.withScheduledTimeTableBuilder(builder -> builder.addTripTimes(tripTimes))
236+
.withCreatedByRealtimeUpdater(true)
236237
.build();
237238

238239
RealTimeTripTimesBuilder builder = tripTimes.createRealTimeFromScheduledTimes();

application/src/test/java/org/opentripplanner/updater/trip/siri/moduletests/extrajourney/ExtraJourneyTest.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import static org.junit.jupiter.api.Assertions.assertNotNull;
5+
import static org.junit.jupiter.api.Assertions.assertTrue;
56
import static org.opentripplanner.transit.model._data.FeedScopedIdForTestFactory.id;
67
import static org.opentripplanner.updater.spi.UpdateResultAssertions.assertFailure;
78

@@ -79,6 +80,20 @@ void testAddJourneyWithExistingRoute() {
7980
transitService.findPatterns(route).size(),
8081
"The added trip should use a new pattern for this route"
8182
);
83+
84+
// Verify ExtraJourney appears in departure board (#7008)
85+
var expectedPattern = transitService.findPattern(trip);
86+
var patternsAtStopC = transitService.findPatterns(STOP_C, true);
87+
assertTrue(
88+
patternsAtStopC.contains(expectedPattern),
89+
"ExtraJourney pattern should appear in patterns for stop C (departure board)"
90+
);
91+
92+
var patternsAtStopD = transitService.findPatterns(STOP_D, true);
93+
assertTrue(
94+
patternsAtStopD.contains(expectedPattern),
95+
"ExtraJourney pattern should appear in patterns for stop D (arrival board)"
96+
);
8297
}
8398

8499
@Test

0 commit comments

Comments
 (0)