diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-15 17:33:28 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-08-15 17:38:13 +0200 |
commit | 9b7013907b8e7aeb9703c841c33ef337bdfbcece (patch) | |
tree | 2f5f7f80984ead00eca52201d2617e1bc9c4b123 /lib/Travelynx.pm | |
parent | d156e3389ee4786b0f8dc3b6a4cc9da1245109b8 (diff) |
stats, map: deal with multiple EVA IDs mapping to the same station name
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 36824c3..b4a9e06 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -2136,6 +2136,31 @@ sub startup { my $to_index = first_index { $_->[2] and $_->[2] == $to_eva } @polyline; + # Work around inconsistencies caused by a multiple EVA IDs mapping to the same station name + if ( $from_index == -1 ) { + for my $entry ( @{ $journey->{route} // [] } ) { + if ( $entry->[0] eq $journey->{from_name} ) { + $from_eva = $entry->[1]; + $from_index + = first_index { $_->[2] and $_->[2] == $from_eva } + @polyline; + last; + } + } + } + + if ( $to_index == -1 ) { + for my $entry ( @{ $journey->{route} // [] } ) { + if ( $entry->[0] eq $journey->{to_name} ) { + $to_eva = $entry->[1]; + $to_index + = first_index { $_->[2] and $_->[2] == $to_eva } + @polyline; + last; + } + } + } + if ( $from_index == -1 or $to_index == -1 ) { |