summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-01-14 09:54:26 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-01-14 09:54:26 +0100
commit49463c761974b19826a16270c9e884a4fc298a31 (patch)
tree312e014776df329b4cd82714911e93d36fb2a99e
parent8da6180bf186523af9aadd51ff5512a278f3e300 (diff)
train details: show expected arrival time at first stop, if available4.14.10
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm17
-rw-r--r--templates/_train_details.html.ep5
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 5c282bd..78123d9 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -809,9 +809,16 @@ sub render_train {
}
)->wait;
+ $departure->{composition}
+ = $self->app->train_details_db->{ $departure->{train_no} };
+ if ( not $departure->{arrival}
+ and $departure->{composition}{prepTime}
+ and $departure->{composition}{prepAt} eq $station_name )
+ {
+ $departure->{prep_time} = $departure->{composition}{prepTime};
+ $departure->{arrival_hidden} = 1;
+ }
if ( $self->param('detailed') ) {
- $departure->{composition}
- = $self->app->train_details_db->{ $departure->{train_no} };
my @cycle_from;
my @cycle_to;
for my $pred ( @{ $departure->{composition}{predecessors} // [] } ) {
@@ -834,8 +841,10 @@ sub render_train {
departure => $departure,
linetype => $linetype,
icetype => $self->app->ice_type_map->{ $departure->{train_no} },
- details => $departure->{composition} // {},
- dt_now => DateTime->now( time_zone => 'Europe/Berlin' ),
+ details => $self->param('detailed')
+ ? $departure->{composition} // {}
+ : {},
+ dt_now => DateTime->now( time_zone => 'Europe/Berlin' ),
station_name => $station_name,
nav_link =>
$self->url_for( 'station', station => $station_name )
diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep
index 3e07cf8..ab6ea45 100644
--- a/templates/_train_details.html.ep
+++ b/templates/_train_details.html.ep
@@ -64,6 +64,9 @@
An: <%= $departure->{arrival} %>
% }
% }
+% elsif ($departure->{prep_time}) {
+ Ein: <%= $departure->{prep_time} %>
+% }
</div>
</div>
<div>
@@ -88,7 +91,7 @@
<%= $left %>Gleis <%= $departure->{platform} // $departure->{scheduled_platform} %><%= $right %>
% }
% }
-% if ($departure->{arrival_hidden}) {
+% if ($departure->{arrival_hidden} and not $departure->{prep_time}) {
<br/><span class="timehidden">Nur Einstieg</span>
% }
% if ($departure->{departure_hidden}) {