HAFAS backend: handle passing the same stop more than once #122
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.
Moin,
this is a patch aspiring to fix #90 and #83. Currently the HAFAS backend in various places picks the first stop on the route that matches the EVA/name of the requested checkin and checkout points, without considering the arrival and departure times.
The IRIS backend appears to have these checks in place already—
travelynx/lib/Travelynx.pm
Lines 767 to 776 in c04e58a
i've added the same kind of checks to various places:
_checkin_hafas
and_checkout_hafas
functions do a somewhat-lenient match on the provided timestamp to find the correct stop.index.pl work
automatic checkout has also been patched to consider the timestamps.some notes:
add_route_timestamps
hasn't been called yet and no timestamp data is available. this is worked around by just ignoring unknown time values, but it would be a good UI improvement and reduce these edge cases if it was possible to delay rendering the view untiladd_route_timestamps
has been called. i was not able to do that.sched_arr
,sched_arrival
,sched_arr_ts
,sched_arrival_ts
, each one might be aDateTime
, an epoch seconds number or undefined altogether and handling them with anything less than the very verbosely-named helper function that i wound up writing is a recipe for hard to predict "can't compare DateTime with undef" or whatever issues. on the long term some comments and documentation on from what contexts these functions might be called would be greatly appreciated.Cheers c: