From 7aea107162e71b32c672bf1563a78bf378c51c2c Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 3 Dec 2024 08:21:07 +0100 Subject: [PATCH] Switch GTFS flex durations back to seconds --- .../java/org/opentripplanner/gtfs/mapping/TripMapper.java | 2 +- .../java/org/opentripplanner/gtfs/mapping/TripMapperTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java b/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java index daf20445767..7b1614aa4d5 100644 --- a/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java +++ b/application/src/main/java/org/opentripplanner/gtfs/mapping/TripMapper.java @@ -84,7 +84,7 @@ private Optional mapSafeTimePenalty(org.onebusaway.gtfs.model.Trip } else { var offset = rhs.getSafeDurationOffset() == null ? Duration.ZERO - : Duration.ofMinutes(rhs.getSafeDurationOffset().longValue()); + : Duration.ofSeconds(rhs.getSafeDurationOffset().longValue()); var factor = rhs.getSafeDurationFactor() == null ? 1d : rhs.getSafeDurationFactor().doubleValue(); diff --git a/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java b/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java index 4132b73826c..12df141eaf4 100644 --- a/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java +++ b/application/src/test/java/org/opentripplanner/gtfs/mapping/TripMapperTest.java @@ -150,8 +150,8 @@ void testFlexFactorAndOffset( private static Stream provideOffsetAndFactor() { return Stream.of( - Arguments.of(1.5d, 60d, 1.5d, Duration.ofHours(1)), - Arguments.of(null, 120d, 1d, Duration.ofHours(2)), + Arguments.of(1.5d, 60d, 1.5d, Duration.ofMinutes(1)), + Arguments.of(null, 120d, 1d, Duration.ofMinutes(2)), Arguments.of(1.5d, null, 1.5d, Duration.ZERO) ); }