summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-07-08 20:47:54 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-07-08 20:47:54 +0200
commit17563a9284665f5f9852ce9da25b94c8bb9389c2 (patch)
tree37dc8c2960b251164d00d746b901fdc0d963e4db /lib/DBInfoscreen.pm
parente04f4cde71003079789236b9b4ccb6b90b2806cb (diff)
distinguish between 'on time' and 'no realtime data available' in rt=1
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r--lib/DBInfoscreen.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index 1fd3674..174fc97 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -273,6 +273,25 @@ sub startup {
}
);
+ $self->helper(
+ 'get_rt_time_class' => sub {
+ my ( $self, $train ) = @_;
+ if ( $train->{has_realtime}
+ and not $train->{is_bit_delayed}
+ and not $train->{is_delayed} )
+ {
+ return 'on-time';
+ }
+ if ( $train->{is_bit_delayed} ) {
+ return 'a-bit-delayed';
+ }
+ if ( $train->{is_delayed} ) {
+ return 'delayed';
+ }
+ return q{};
+ }
+ );
+
my $r = $self->routes;
$r->get('/_redirect')->to('stationboard#redirect_to_station');