summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 19:16:01 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-07-15 19:16:01 +0200
commitbee67f096a5732fed5cb9c3e716012b536950022 (patch)
treebdb9798b73d4ca305bb51ed34f70efe6ba597caa /lib
parent40cd1d06feb83396676892d30e386c934e017b9b (diff)
get_user_status: fix stop_before_dest calculation
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 9c052e3..5b8680e 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -1446,10 +1446,18 @@ sub startup {
= scalar @{ $ret->{route_after} }
? $ret->{route_after}[0][0]
: undef;
- my $stop_before_dest
- = scalar @{ $ret->{route_after} }
- ? $ret->{route_after}[-1][0]
- : undef;
+ my $stop_before_dest;
+ for my $i ( 1 .. $#{ $ret->{route_after} } ) {
+ if ( $ret->{arr_name}
+ and $ret->{route_after}[$i][0] eq $ret->{arr_name} )
+ {
+ $stop_before_dest = $ret->{route_after}[ $i - 1 ][0];
+ last;
+ }
+ }
+
+ say $stop_after_dep;
+ say $stop_before_dest;
my ($dep_platform_number)
= ( ( $ret->{dep_platform} // 0 ) =~ m{(\d+)} );