Calculate fares from itineraries not Raptor paths, calculate flex fares - #3743
Conversation
870f0de to
0caa037
Compare
|
Review comments:
|
t2gran
left a comment
There was a problem hiding this comment.
Nice, not much to pick on here, just a big block inside a stream chain.
…edTripTest.java Co-authored-by: Thomas Gran <t2gran@gmail.com>
|
This PR switches from the "official" |
246b1a8 to
3955701
Compare
3955701 to
4a32449
Compare
|
I moved the check of whether to add the intermediate stops should be added to the REST API layer. This means that the SnapshotTest had to be modified as well to because the internal model now always has the intermediate stops. |
|
My PR to the OBA repo has been merged. This means it's no longer necessary to use my forked version. |
| import org.opentripplanner.model.StopLocation; | ||
|
|
||
| /** | ||
| * A set of edges on a single route, with associated information. Used only in calculating fares. |
There was a problem hiding this comment.
In the future, I'd like to get rid of this class, all operations where this is used, should be done on regular Leg objects
Summary
As discussed in a previous dev meeting, I converted the fare calculation code so it uses Itinerary and not RaptorPath as the input. This makes it easy to calculate the fares for other types of trips that don't have a RaptorPath, like flex trips do.
I tried to keep the old fare calculation code as untouched as possible apart from a single small-ish refactoring, namely converting the times in Ride from untyped longs to ZonedDateTime.
The fares are actually calculated in TransitRouter and FlexRouter but we said that we want to move this to a later phase of the computation, perhaps the filter chain.
Right now this PR depends on OneBusAway/onebusaway-gtfs-modules#183 before it can be merged.
If it isn't merged and released by upstream soon-ish, would you be ok if I published this to Maven Central under my own namespace?
Issue
Fixes #3656
Unit tests
I managed to reactivate very old tests for the fare calculation feature. I also added ones for calculating fares for direct flex searches.
Code style
Yes.
Documentation
Yes.