diff options
| author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-08-04 14:35:13 +0200 | 
|---|---|---|
| committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-08-04 14:35:42 +0200 | 
| commit | 342f1bc29510ff266436d9c0c1301b90530b2270 (patch) | |
| tree | 80e0f9df3f8f70a9ae3b03b85cbfdf590a018c1d /lib | |
| parent | db37b4926926504fa85be82b76adef88292cc643 (diff) | |
estimate_trip_position: Handle long stops (use dep, not arr)2.16.4
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Travelynx/Model/InTransit.pm | 13 | 
1 files changed, 5 insertions, 8 deletions
| diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm index aa16038..5f27a22 100644 --- a/lib/Travelynx/Model/InTransit.pm +++ b/lib/Travelynx/Model/InTransit.pm @@ -1623,7 +1623,6 @@ sub estimate_trip_position {  	my ( $self, $in_transit ) = @_;  	my @now_latlon; -	my $next_stop;  	my @route = @{ $in_transit->{route} };  	# estimate_train_position runs before postprocess, so all route @@ -1634,8 +1633,9 @@ sub estimate_trip_position {  	for my $i ( 0 .. $#route ) {  		my $ts = $route[$i][2]{rt_arr} // $route[$i][2]{sched_arr}  		  // $route[$i][2]{rt_dep} // $route[$i][2]{sched_dep} // 0; -		if (    not $next_stop -			and $ts +		my $ts_dep = $route[$i][2]{rt_dep} // $route[$i][2]{sched_dep} +		  // $route[$i][2]{rt_arr} // $route[$i][2]{sched_arr} // 0; +		if (    $ts  			and $prev_ts  			and $now > $prev_ts  			and $now < $ts ) @@ -1648,12 +1648,9 @@ sub estimate_trip_position {  				to_ts    => $ts,  				polyline => $in_transit->{polyline},  			); -			$next_stop = { -				type    => 'next', -				station => $route[$i], -			}; +			last;  		} -		$prev_ts = $ts; +		$prev_ts = $ts_dep;  	}  	if (    not @now_latlon | 
