summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2020-09-21 22:21:01 +0200
committerDaniel Friesel <derf@finalrewind.org>2020-09-21 22:21:01 +0200
commit33dda200871e1819e272754354d6b7ac4423c94c (patch)
treea1eb675f534ea24a4aa31e3380b3a648e43fb203 /lib
parent7d6a333d2e333f3c933927cc57418a7c42998e4c (diff)
make train details work up to 20 minutes into the past3.3.1
Diffstat (limited to 'lib')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index bc2f054..9efe0c3 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -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};