From 18e06ad1831b8ea45a87426b75243a7f4ef9f534 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 18 Jul 2021 09:11:26 +0200 Subject: departure view: use IRIS to decide whether realtime is missing --- lib/DBInfoscreen/Controller/Stationboard.pm | 13 ++++++++++++- templates/_train_details.html.ep | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index b71d6d8..0d5a96a 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -475,6 +475,16 @@ sub render_train { ) ]; + if ( not $result->has_realtime ) { + my $now = DateTime->now( time_zone => 'Europe/Berlin' ); + if ( $result->start < $now ) { + $departure->{missing_realtime} = 1; + } + else { + $departure->{no_realtime_yet} = 1; + } + } + my $linetype = 'bahn'; my @classes = $result->classes; if ( @classes == 0 ) { @@ -680,7 +690,8 @@ sub render_train { } if ($route_ts) { if ( $route_ts->{ $result->station }{rt_bogus} ) { - $departure->{missing_realtime} = 1; + + #$departure->{missing_realtime} = 1; } for my $elem ( @{ $departure->{route_pre_diff} }, diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index eea449d..ab96c38 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -133,10 +133,10 @@ <%= $link->[0] %> % } % if ($departure->{missing_realtime}) { - Echtzeitdaten fehlen + Echtzeitdaten fehlen % } -% elsif ($departure->{partially_missing_realtime}) { - Echtzeitdaten unvollständig +% elsif ($departure->{no_realtime_yet}) { + Noch keine Echtzeitdaten verfügbar % } @@ -225,7 +225,7 @@ (heute <%= $departure->{arrival} %>) % } % } -% if ($departure->{missing_realtime}) { +% if ($departure->{missing_realtime} or $departure->{no_realtime_yet}) { gps_off % } <%= stash('station_name') %> -- cgit v1.2.3