Commit 33dda200 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

make train details work up to 20 minutes into the past

parent 7d6a333d
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -260,6 +260,13 @@ sub handle_request {
		$opt{with_related} = 1;
	}

	if ($self->param('train')) {
		# request results from five minutes ago to avoid train details suddenly
		# becoming unavailable when its scheduled departure is reached.
		$opt{datetime} = DateTime->now(time_zone => 'Europe/Berlin')->subtract(minutes => 20);
		$opt{lookahead} = 200;
	}

	my $data   = get_results_for( $backend, $station, %opt );
	my $errstr = $data->{errstr};

@@ -654,6 +661,9 @@ sub train_details {
	$self->stash( title      => 'DBF' );
	$self->stash( version    => $dbf_version );

	$opt{datetime} = DateTime->now(time_zone => 'Europe/Berlin')->subtract(minutes => 20);
	$opt{lookahead} = 200;

	my $data   = get_results_for( 'iris', $station, %opt );
	my $errstr = $data->{errstr};