summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-12-21 01:05:43 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-12-21 01:05:43 +0100
commit69568899ff68292fb4855bf5906fb3f56c72d9a7 (patch)
tree2c21032875f7575ddd439e2bf8e2a94e46fb48cc
parenta668150460042c299aa33fdc411b93313ef5a7bc (diff)
set S-Bahn type for non-DB S-Bahn trains as well
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm10
-rw-r--r--templates/app.html.ep3
-rw-r--r--templates/infoscreen.html.ep3
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 79538a0..c3c720b 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -993,7 +993,8 @@ sub handle_request {
# stops. This is a rare case, one point where it can be observed is
# the TGV service at Frankfurt/Karlsruhe/Mannheim.
if ( $route_info
- and my @hafas_stations = @{ $route_info->{stations} } )
+ and my @hafas_stations
+ = @{ $route_info->{stations} // [] } )
{
if ( my @iris_stations
= @{ $departures[-1]{route_pre_diff} } )
@@ -1059,7 +1060,7 @@ sub handle_request {
}
}
}
- if ( $route_info and @{ $route_info->{messages} } ) {
+ if ( $route_info and @{ $route_info->{messages} // [] } ) {
my $him = $route_info->{messages};
my @him_messages;
$departures[-1]{messages}{him} = $him;
@@ -1174,6 +1175,11 @@ sub handle_request {
{
$linetype = 'ext';
}
+ elsif ( $departure->{train_line}
+ and $departure->{train_line} =~ m{^S\d} )
+ {
+ $linetype = 'sbahn';
+ }
$self->render(
'_train_details',
diff --git a/templates/app.html.ep b/templates/app.html.ep
index a769bd5..b35ca59 100644
--- a/templates/app.html.ep
+++ b/templates/app.html.ep
@@ -51,6 +51,9 @@
% or $departure->{train_type} eq 'NJ') {
% $linetype = 'ext';
% }
+% elsif ( $departure->{train_line} and $departure->{train_line} =~ m{^S\d} ) {
+% $linetype = 'sbahn';
+% }
<li
data-train="<%= ($departure->{train_type} // q{}) %> <%= ($departure->{train_no} // $departure->{train} // q{}) %>"
data-line="<%= $departure->{train_type} %> <%= $departure->{train_line} // $departure->{train_no} %>"
diff --git a/templates/infoscreen.html.ep b/templates/infoscreen.html.ep
index 8b1dd5c..85d0f8d 100644
--- a/templates/infoscreen.html.ep
+++ b/templates/infoscreen.html.ep
@@ -43,6 +43,9 @@
% or $departure->{train_type} eq 'NJ') {
% $linetype = 'ext';
% }
+% elsif ( $departure->{train_line} and $departure->{train_line} =~ m{^S\d} ) {
+% $linetype = 'sbahn';
+% }
<div class="line <%= $linetype %>">
% if ($departure->{train_type} and $departure->{train_no}) {
%= $departure->{train_type}