diff options
| author | Daniel Friesel <daniel.friesel@uos.de> | 2021-08-31 17:56:35 +0200 | 
|---|---|---|
| committer | Daniel Friesel <daniel.friesel@uos.de> | 2021-08-31 17:56:35 +0200 | 
| commit | f88817d98eedc3f0c99857e842127a5f4b78fba2 (patch) | |
| tree | 24fcb5fb2b621e51250d154ffb9656b3c333367f /lib/DBInfoscreen/Controller | |
| parent | 39746c144b1bcfccaaae1dc9534c3017c4814bf5 (diff) | |
Add past option
Diffstat (limited to 'lib/DBInfoscreen/Controller')
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 21 | 
1 files changed, 17 insertions, 4 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 3ff5a69..77f3a7d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -268,6 +268,12 @@ sub handle_request {  		lookahead       => $self->config->{lookahead}  	); +	if ( $self->param('past') ) { +		$opt{datetime} = DateTime->now( time_zone => 'Europe/Berlin' ) +		  ->subtract( minutes => 60 ); +		$opt{lookahead} += 60; +	} +  	my $api_version = $Travel::Status::DE::IRIS::VERSION;  	$self->stash( departures => [] ); @@ -320,7 +326,7 @@ sub handle_request {  		$opt{with_related} = 1;  	} -	if ( $self->param('train') ) { +	if ( $self->param('train') and not $opt{datetime} ) {         # request results from twenty minutes ago to avoid train details suddenly         # becoming unavailable when its scheduled departure is reached. @@ -811,9 +817,16 @@ sub station_train_details {  	$self->stash( title      => 'DBF' );  	$self->stash( version    => $self->config->{version} ); -	$opt{datetime} = DateTime->now( time_zone => 'Europe/Berlin' ) -	  ->subtract( minutes => 20 ); -	$opt{lookahead} = $self->config->{lookahead} + 20; +	if ( $self->param('past') ) { +		$opt{datetime} = DateTime->now( time_zone => 'Europe/Berlin' ) +		  ->subtract( minutes => 80 ); +		$opt{lookahead} = $self->config->{lookahead} + 80; +	} +	else { +		$opt{datetime} = DateTime->now( time_zone => 'Europe/Berlin' ) +		  ->subtract( minutes => 20 ); +		$opt{lookahead} = $self->config->{lookahead} + 20; +	}  	my $data   = get_results_for( $station, %opt );  	my $errstr = $data->{errstr}; | 
