Account for station arrival and departure times when highlighting route in journey view #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The page template for the journey view highlights the stations in the route which form part of the journey. However, it assumes that the route does not pass through the same station more than once.
My real-world example which violates this assumption is BVG bus line 390, which both starts and ends at S Ahrensfelde Bhf and also passes through some intermediate stops like Ahrensfelde Friedhof Bhf twice. Taking journey from Ahrensfelde Friedhof Bhf the second time the bus stops there to the terminal stop of S Ahrensfelde Bhf results in the initial departure stop at S Ahrensfelde Bhf being highlighted, as well as the rest of the route starting at the first stop at Friedhof Bhf.
This change extends the algorithm which applies the highlight styling to account for the arrival and departure times for each stop on the route where available, and attempts to match them to the journey arrival and departure times. (This ensures that the correct occurrence of Ahrensfelde Friedhof Bhf is selected.) Additionally, it also adjusts the condition for detecting the last station of the journey of the route so that it doesn't trigger until the first station has been found. (This ensures that the initial departure stop at S Ahrensfelde Bhf is not incorrectly highlighted.) This should also improve the journey highlighting for other ring lines like the Berliner Ringbahn as well.