Skip to content
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

Account for station arrival and departure times when highlighting route in journey view #190

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sysvinit
Copy link
Contributor

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.

…rney route

If the route contains some stations more than once, use the departure and
arrival times for the journey and each station (where available) to distinguish
between occurrences of the same station.
@Ein-Tim
Copy link

Ein-Tim commented Jan 16, 2025

Is this a duplicate of #122?

@sysvinit
Copy link
Contributor Author

Is this a duplicate of #122?

Ah, yes, at least partially -- this only fixes the UI in the journey view rather than any of the deeper logic for selecting check-in and check-out stations, though that might have since been fixed since the other PR was opened. I didn't check for other open PRs when I wrote this one, as it seemed a relatively straightforward fix and I wanted to try fixing it myself instead of reporting an issue and leaving the work to derf.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants