Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev-2.x' into arrive-by-filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Sep 16, 2024
2 parents 1af7cd3 + ea461af commit c1ef7ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions doc/user/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ based on merged pull requests. Search GitHub issues and pull requests for smalle
- Add Javadoc for Trip [#6022](https://github.com/opentripplanner/OpenTripPlanner/pull/6022)
- Add Iceland to the list of deployments [ci skip] [#6057](https://github.com/opentripplanner/OpenTripPlanner/pull/6057)
- Use correct HEAD request when fetching HTTP headers [#6063](https://github.com/opentripplanner/OpenTripPlanner/pull/6063)
- Fix incorrect mapping of flex safe duration offset [#6059](https://github.com/opentripplanner/OpenTripPlanner/pull/6059)
[](AUTOMATIC_CHANGELOG_PLACEHOLDER_DO_NOT_REMOVE)

## 2.5.0 (2024-03-13)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private Optional<TimePenalty> mapSafeTimePenalty(org.onebusaway.gtfs.model.Trip
if (rhs.getSafeDurationFactor() == null && rhs.getSafeDurationOffset() == null) {
return Optional.empty();
} else {
var offset = Duration.ofSeconds(rhs.getSafeDurationOffset().longValue());
var offset = Duration.ofMinutes(rhs.getSafeDurationOffset().longValue());
return Optional.of(TimePenalty.of(offset, rhs.getSafeDurationFactor().doubleValue()));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.time.Duration;
import java.util.Collection;
import java.util.Collections;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -122,12 +123,12 @@ void flexTimePenalty() {
var flexTrip = new Trip();
flexTrip.setId(new AgencyAndId("1", "1"));
flexTrip.setSafeDurationFactor(1.5);
flexTrip.setSafeDurationOffset(600d);
flexTrip.setSafeDurationOffset(60d);
flexTrip.setRoute(new GtfsTestData().route);
var mapper = defaultTripMapper();
var mapped = mapper.map(flexTrip);
var penalty = mapper.flexSafeTimePenalties().get(mapped);
assertEquals(1.5f, penalty.coefficient());
assertEquals(600, penalty.constant().toSeconds());
assertEquals(Duration.ofHours(1), penalty.constant());
}
}

0 comments on commit c1ef7ae

Please sign in to comment.