diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 16:47:23 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-07-27 16:47:23 +0200 |
commit | 136c83548efceaa08e60d4dd9bd81a1bbb733032 (patch) | |
tree | 73dce571e94fa2ac9eeccce65ac438a3360cd4e4 | |
parent | dd64dbae37e05d5cb2c96277e31d5247074732d2 (diff) |
polyline handling is hard
-rwxr-xr-x | lib/Travelynx/Model/Journeys.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index fd9f9b1..c9ac28d 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -1260,7 +1260,8 @@ sub get_travel_distance { # majority of trips do not pass the same stop multiple times, it's better # to risk having a few inaccurate distances than not calculating the # distance for any journey that lacks sched_dep/rt_dep or - # schep_from/rt_from. + # sched_from/rt_from. + my @route = after_incl { ( ( $_->[1] and $_->[1] == $from_eva or $_->[0] eq $from ) @@ -1289,6 +1290,11 @@ sub get_travel_distance { return ( 0, 0, $distance_beeline ); } + # TODO this always selects the first stop entry. + # Gotta count how many duplicates we need to skip... + # Approach: build dict route id -> polyline id of corresponding stop + # (and bail out if route stops ≠ polyline stops), + # then find indexes from route and select polyline range from those my @polyline = after_incl { $_->[2] and $_->[2] == $from_eva } @{ $polyline_ref // [] }; @polyline |