Repository navigation
Improve linking of fixed stops used by flex trips - #5503
Conversation
1378217 to
86ad821
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #5503 +/- ##
=============================================
+ Coverage 66.85% 66.92% +0.07%
- Complexity 15655 15697 +42
=============================================
Files 1817 1818 +1
Lines 70160 70244 +84
Branches 7383 7392 +9
=============================================
+ Hits 46904 47013 +109
+ Misses 20798 20776 -22
+ Partials 2458 2455 -3 ☔ View full report in Codecov by Sentry. |
031a3d0 to
348dedb
Compare
|
I discussed this a bit with @andtry today. I think we should restrict the NeTEx We might have to change this in the future, but until then this restriction will make the OTP code a bit less vulnerable. We (Entur) will try to make a PR for this. Doc: fixedStopAreaWide |
|
|
||
| public TransitStopVertex findTransitStopVertices(FeedScopedId stopId) { | ||
| @Nullable | ||
| public TransitStopVertex getTransitStopVertex(FeedScopedId stopId) { |
There was a problem hiding this comment.
FYI: According to the naming conventions this does not follow either get or find. Changing this to throw an exception is the "right" thing to do, but I am not sure if we can do it - we might have stops outside the area covered by OSM data - and throwing exception should only be done in cases where we expect it to not happen. I would not have changed the name here.
There was a problem hiding this comment.
Reverted in d91d7c1 but the name findTransitStopVertices is obviously wrong.
| if ( | ||
| linkType == StopLinkType.WALK_AND_CAR && !walkStreetVertex.isConnectedToDriveableEdge() | ||
| ) { | ||
| graph |
There was a problem hiding this comment.
Consider adding the edges returned here, not adding them inside the function (line 167).
There was a problem hiding this comment.
If you do this line 163-169 collapses as well.
There was a problem hiding this comment.
I'm not sure I follow you. linkVertexPermanently returns void. (That is indeed a bit strange and we don't really need to return anything here, but I'm just following the idiom.) I can explain a bit in a dev meeting,
| return linkEdges; | ||
| } | ||
| ); | ||
| } |
There was a problem hiding this comment.
The above function call has a large code-block as one of the arguments - from a clean code perspective this is not the "same level of abstraction". I would make a few private functions and inject those. You have some inline doc here as well witch then could be moved to be JavaDoc.
There was a problem hiding this comment.
I've reworked it a bit in the latest commit.
|
Thank you for fixing this @leonardehrenfried, I only had a quick look at the core changes - @vpaturet will do the final review from us. Except for the small stuff I pointed out everything looks ok with me, but I will leave the approval to @vpaturet. |
0dcd680 to
778aa74
Compare
778aa74 to
e6a1cd0
Compare
vpaturet
left a comment
There was a problem hiding this comment.
Tested on Norwegian data, the issue is fixed, no side-effects observed.
Summary
As shown in #5498 adding stops which are far away from walkable edges to flex trips can lead to catastrophic results.
This PR improves the situation as follows:
This leads to desirable results like these
Further work
There is a slight problem though: the extra link for the flex trip is also accessible for pedestrians.
We can improve this by making the links mode specific. I suggest that we improve this problem in this PR and follow up later.
Issue
Closes #5498
Unit tests
Some added plus a bit of refactoring of the existing tests.
Documentation
Javadoc.