summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen.pm
diff options
context:
space:
mode:
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');