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

🐛 Fix issues related to checking into international trains #2407

Merged

Conversation

fabiancdng
Copy link
Contributor

As issue #2401 already mentioned, checking into UK trains does not seem to work. Neither using the old check-in interface nor using the new (experimental) one.

I've never worked on the Träwelling codebase before, so take this with a grain of salt 😅

New check-in interface

To me it looks like the issue with the new interface was due to many UK trains not having a line name provided in the data. Some Vue components were not accounting for that.
I fixed this by checking for empty line names and using the fahrtNr as a fallback. This seemed to be the preferred solution looking at the old interface.
This actually seems to resolve the display glitches and the 422 errors when trying to check into a train:
Screenshot 2024-03-10 at 18 49 50

Old check-in interface

However, the old interface doesn't seem to have any issues with empty line names. The only problem there is the empty stopovers. As far as I can tell, this issue is related to the filtering of stopovers introduced in #2322.

The UK trains seem to provide the planned departure (departure_planned) in their own timezone. Hence, checking against the departure time passed by the front end does not work (as the UK time is one hour behind).

I removed the departure time check and only kept the check against the start station passed by the front end. I hope this is sufficient? Not entirely sure on that one though.

Before:
Screenshot 2024-03-10 at 18 47 15

After:
Screenshot 2024-03-10 at 18 48 04

Resolves #2401

In the (new) Vue implementation of the station board, fix an issue where the board glitches and the check-in fails if trains do not have `line.name` set.
Provide `line.fahrtNr` as a fallback.
Fix a bug where no intermediate stops are shown when trying to check into an international train operating in a different timezone.
This is due to the way stopovers after the start station are determined:
The `departure_planned` and `departure` passed from the front end cannot simply be compared as they might refer to different timezones.
@HerrLevin
Copy link
Member

@fabiancdng I'm fine with the changes. Close or resolve the comments with what works for you, give me a ping and we'll merge it.

@HerrLevin
Copy link
Member

@fabiancdng Wait no, one last thing: You might want to change all || to ?? because there might be some weird situation where a linename is 0 or sth. We're talking about public public transport - You have to expect the unexpected.

Fix wrong check due to the use of logical or (`||`) instead of null coalescing (`??`) operator.
@fabiancdng
Copy link
Contributor Author

@HerrLevin Good catch! 😄 I fixed the operator in 58e72ec.
Feel free to merge if there's nothing else.

@HerrLevin HerrLevin merged commit 914f8a3 into Traewelling:develop Mar 16, 2024
@d3d9
Copy link
Contributor

d3d9 commented Apr 5, 2024

Here's a reminder that the removal of the check for departure time equality caused new issues on trips that contain the the same stopover multiple times, as I mentioned in #2407 (comment) using my wrong account. I won't repeat the description, furthermore I don't have the capacity to create a new issue or fix it myself. I just wanted to put this comment here as a reminder since I feel it might have been overseen, especially as github hides it behind a resolved review.

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

Successfully merging this pull request may close these issues.

Intermediate stops not appearing
5 participants