From ebb6c9174e0a4622904e8bccd7248609bb66ad8d Mon Sep 17 00:00:00 2001
From: Daniel Friesel <derf@finalrewind.org>
Date: Sun, 18 Jul 2021 12:56:58 +0200
Subject: show mising realtime data in departure overview as well

---
 lib/DBInfoscreen/Controller/Stationboard.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

(limited to 'lib')

diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 5793ae5..a52a3ce 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -1025,6 +1025,8 @@ sub handle_result {
 	my $callback       = $self->param('callback');
 	my $via            = $self->param('via');
 
+	my $now = DateTime->now( time_zone => 'Europe/Berlin' );
+
 	if ( $self->param('ajax') ) {
 		delete $self->stash->{layout};
 	}
@@ -1184,6 +1186,12 @@ sub handle_result {
 								} $result->qos_messages
 							],
 						},
+						missingRealtime => (
+							(
+								not $result->has_realtime
+								  and $result->start < $now
+							) ? \1 : \0
+						),
 						platform           => $result->platform,
 						route              => \@json_route,
 						scheduledPlatform  => $result->sched_platform,
@@ -1255,6 +1263,10 @@ sub handle_result {
 					station          => $result->station,
 					moreinfo         => $moreinfo,
 					delay            => $delay,
+					missing_realtime => (
+						not $result->has_realtime
+						  and $result->start < $now ? 1 : 0
+					),
 					route_pre        => [ $result->route_pre ],
 					route_post       => [ $result->route_post ],
 					additional_stops => [ $result->additional_stops ],
-- 
cgit v1.2.3