-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple zones in an unscheduled flex trip #5376
Allow multiple zones in an unscheduled flex trip #5376
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5376 +/- ##
=============================================
+ Coverage 66.58% 66.62% +0.04%
- Complexity 15318 15336 +18
=============================================
Files 1792 1792
Lines 69540 69537 -3
Branches 7333 7334 +1
=============================================
+ Hits 46301 46330 +29
+ Misses 20756 20733 -23
+ Partials 2483 2474 -9
☔ View full report in Codecov by Sentry. |
e5925a8
to
6774c62
Compare
@t2gran I had an idea how to make the scope of this PR smaller: how about I allow only one or two zones in an |
e2162c8
to
d3b6fc5
Compare
We have discussed this issue at Entur today, and I think we can go forward with this PR. This mean that we agree one the business rule:
@leonardehrenfried Can a trip go from Stop 3 to Stop 2 if the times allow it? |
Great - thanks for the feedback!
I will add this rule to the Javadoc.
My understanding is that it should not be possible but I will write a unit test to make sure. Or do you believe that it should be possible? |
4ae2834
to
dd2b2ff
Compare
Actually, there was already a test for that and the code for it is here: OpenTripPlanner/src/ext/java/org/opentripplanner/ext/flex/trip/UnscheduledTrip.java Lines 110 to 111 in dd2b2ff
|
I also agree that this should not be possible. If travel from 3 to 2 is possible, then there should be another trip where 3 appears before 2 in the stop sequence. The rule still holds that stop_sequence increases during a trip, which I've tried to make explicit with an addition to the GTFS-flex spec here: https://github.com/google/transit/pull/388/files/e359750cb2d4a496cf96bdbb1c6e30a73b3fb59f..2efafbfe2b91e0b99313df2391adb3fbc9121861#diff-3ecf0760eb54b4953728042a1e30586705dc2335807be94faae0de5829cd12a1 |
Summary
This allows more than 2 stop times for an unscheduled flex trip, which is legal in GTFS Flex and according to @t2gran also in Netex.
This allows you to have more complex rules about when you're allowed to travel from one zone to another.
In this real world example from Seattle, you are allowed to travel within zone
area_1081
but not within zonearea_897
. You need to board in zonearea_1081
to get toarea_897
.Visual examples of the desired result
You are allowed to travel from King County (south) to Snohomish County (North) on the service called "Volunteer Service".
However, when you flip the origin/destination you will not be offered this service due to the board/alight restrictions on the trip.
Unit tests
Lots added.
I've also refactored the
UnscheduledTripTest
to use parameterised tests and extracted the integration tests from the unit tests.Documentation
Javadoc updated.
cc @tsherlockcraig