Unverified Commit d0e81f44 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

estimate_trip_position: handle country borders (no arr/dep annotations)

parent a5eabdb6
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -1697,6 +1697,7 @@ sub estimate_trip_position {
	my $now = DateTime->now( time_zone => 'Europe/Berlin' )->epoch;

	my $prev_ts;
	my $delta = 1;
	for my $i ( 0 .. $#route ) {
		my $ts
		  = $route[$i][2]{rt_arr}
@@ -1721,7 +1722,7 @@ sub estimate_trip_position {
		{
			@now_latlon = $self->estimate_trip_position_between_stops(
				now      => $now,
				from     => $route[ $i - 1 ],
				from     => $route[ $i - $delta ],
				from_ts  => $prev_ts,
				to       => $route[$i],
				to_ts    => $ts,
@@ -1729,7 +1730,13 @@ sub estimate_trip_position {
			);
			last;
		}
		if ($ts_dep) {
			$prev_ts = $ts_dep;
			$delta   = 1;
		}
		else {
			$delta += 1;
		}
	}

	if (    not @now_latlon