Loading lib/Travelynx/Model/Journeys.pm +13 −4 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use DateTime; use DateTime::Format::Strptime; use GIS::Distance; use JSON; use List::MoreUtils qw(after_incl before_incl); use List::MoreUtils qw(after_incl before_incl first_index); my %visibility_itoa = ( 100 => 'public', Loading Loading @@ -1262,7 +1262,7 @@ sub get_travel_distance { # distance for any journey that lacks sched_dep/rt_dep or # sched_from/rt_from. my @route = after_incl { my $route_start = first_index { ( ( $_->[1] and $_->[1] == $from_eva or $_->[0] eq $from ) and ( not( defined $_->[2]{sched_dep} or defined $_->[2]{rt_dep} ) Loading @@ -1270,14 +1270,23 @@ sub get_travel_distance { ) } @{$route_ref}; @route = before_incl { my $route_end = first_index { ( ( $_->[1] and $_->[1] == $to_eva or $_->[0] eq $to ) and ( not( defined $_->[2]{sched_arr} or defined $_->[2]{rt_arr} ) or ( $_->[2]{sched_arr} // $_->[2]{rt_arr} ) == $to_ts ) ) } @route; @{$route_ref}; if ( not defined $route_start and defined $route_end ) { return ( 0, 0, $distance_beeline ); } $journey->{route_dep_index} = $route_start; $journey->{route_arr_index} = $route_end; my @route = @{$route_ref}[ $route_start .. $route_end ]; if ( @route < 2 Loading templates/journey.html.ep +4 −2 Original line number Diff line number Diff line Loading @@ -257,11 +257,12 @@ % my $before = 1; % my $within = 0; % my $at_startstop = 0; % my $i = 0; % for my $station (@{$journey->{route}}) { % if (($station->[1] and $station->[1] == $journey->{from_eva}) or $station->[0] eq $journey->{from_name}) { % if ($i == $journey->{route_dep_index}) { % $within = 1; $at_startstop = 1; % } % elsif (($station->[1] and $station->[1] == $journey->{to_eva}) or $station->[0] eq $journey->{to_name}) { % elsif ($i == $journey->{route_arr_index}) { % $within = 0; $at_startstop = 1; % } % else { Loading Loading @@ -298,6 +299,7 @@ % $before = 0; % } <br/> % $i += 1; % } </td> </tr> Loading Loading
lib/Travelynx/Model/Journeys.pm +13 −4 Original line number Diff line number Diff line Loading @@ -13,7 +13,7 @@ use DateTime; use DateTime::Format::Strptime; use GIS::Distance; use JSON; use List::MoreUtils qw(after_incl before_incl); use List::MoreUtils qw(after_incl before_incl first_index); my %visibility_itoa = ( 100 => 'public', Loading Loading @@ -1262,7 +1262,7 @@ sub get_travel_distance { # distance for any journey that lacks sched_dep/rt_dep or # sched_from/rt_from. my @route = after_incl { my $route_start = first_index { ( ( $_->[1] and $_->[1] == $from_eva or $_->[0] eq $from ) and ( not( defined $_->[2]{sched_dep} or defined $_->[2]{rt_dep} ) Loading @@ -1270,14 +1270,23 @@ sub get_travel_distance { ) } @{$route_ref}; @route = before_incl { my $route_end = first_index { ( ( $_->[1] and $_->[1] == $to_eva or $_->[0] eq $to ) and ( not( defined $_->[2]{sched_arr} or defined $_->[2]{rt_arr} ) or ( $_->[2]{sched_arr} // $_->[2]{rt_arr} ) == $to_ts ) ) } @route; @{$route_ref}; if ( not defined $route_start and defined $route_end ) { return ( 0, 0, $distance_beeline ); } $journey->{route_dep_index} = $route_start; $journey->{route_arr_index} = $route_end; my @route = @{$route_ref}[ $route_start .. $route_end ]; if ( @route < 2 Loading
templates/journey.html.ep +4 −2 Original line number Diff line number Diff line Loading @@ -257,11 +257,12 @@ % my $before = 1; % my $within = 0; % my $at_startstop = 0; % my $i = 0; % for my $station (@{$journey->{route}}) { % if (($station->[1] and $station->[1] == $journey->{from_eva}) or $station->[0] eq $journey->{from_name}) { % if ($i == $journey->{route_dep_index}) { % $within = 1; $at_startstop = 1; % } % elsif (($station->[1] and $station->[1] == $journey->{to_eva}) or $station->[0] eq $journey->{to_name}) { % elsif ($i == $journey->{route_arr_index}) { % $within = 0; $at_startstop = 1; % } % else { Loading Loading @@ -298,6 +299,7 @@ % $before = 0; % } <br/> % $i += 1; % } </td> </tr> Loading