Fix empty lineName on chekin via API #3184
Open
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.
Hi there ๐๐ผโโ๏ธ
I'm currently developing an Easy Import Shourtcut for iOS to quickly import a trip from the DB Navigator to Traewelling. There I discovered a rather oddly bug happening while checking in with the tripID through the API. Some checkins got a lineName and some didn't. I figured out, that it depends on rather a trip was cached earlier or not. Therefore I took a quick look in the source code.
The
fetchHafasTrip(string $tripID, string $lineName)
sets the lineName only if the lineName is present in$cachedData
. This leads to an empty lineName if the trip wasn't fetched beforehand. Nevertheless the function requires passing the$lineName
parameter, but is never using it in the context of the function. The fix would be to set$tripLineName
to$lienName
if there is no cached lineName.Kind regards
tiuub ๐