diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-26 20:44:46 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-26 20:44:46 +0200 |
commit | f8542fffcd66ceba8ea0114181c942a45d3f8a0d (patch) | |
tree | 0bba058187d2017f11f8ee83c5adc2652989bb21 /lib/Travelynx/Model/Journeys.pm | |
parent | 4b6049cd1ae479b8c2c6ea54ae2ae60d2cd20831 (diff) |
map, get_travel_distance: Prefer EVA ID over name for route matches2.8.33
Station names frequently change, so the EVA ID is more robust
Closes #160
Diffstat (limited to 'lib/Travelynx/Model/Journeys.pm')
-rwxr-xr-x | lib/Travelynx/Model/Journeys.pm | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Travelynx/Model/Journeys.pm b/lib/Travelynx/Model/Journeys.pm index e00c844..79bc322 100755 --- a/lib/Travelynx/Model/Journeys.pm +++ b/lib/Travelynx/Model/Journeys.pm @@ -1192,8 +1192,12 @@ sub get_travel_distance { my $geo = GIS::Distance->new(); my $distance_beeline = $geo->distance_metal( @{$from_latlon}, @{$to_latlon} ); - my @route = after_incl { $_->[0] eq $from } @{$route_ref}; - @route = before_incl { $_->[0] eq $to } @route; + my @route + = after_incl { ( $_->[1] and $_->[1] == $from_eva ) or $_->[0] eq $from } + @{$route_ref}; + @route + = before_incl { ( $_->[1] and $_->[1] == $to_eva ) or $_->[0] eq $to } + @route; if ( @route < 2 or $route[-1][0] ne $to ) { |