diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 19:10:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-12-20 19:10:15 +0100 |
commit | 5a41f843f1d7f57237938712ac08cf5b94450749 (patch) | |
tree | 8b045748807bc88ac96a5bf990dca331db8156c1 /lib/DBInfoscreen/Controller | |
parent | 2016a340657bf477ac85a344b8d8a8f8f7563663 (diff) |
show zugbildung (if available); show scheduled wagon order for nightjets too3.8.0
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 4 | ||||
-rw-r--r-- | lib/DBInfoscreen/Controller/Wagenreihung.pm | 14 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 752b099..b168b6b 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -673,7 +673,9 @@ sub render_train { departure => $departure, linetype => $linetype, icetype => $self->app->ice_type_map->{ $departure->{train_no} }, - dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), + details => + $self->app->train_details_db->{ $departure->{train_no} }, + dt_now => DateTime->now( time_zone => 'Europe/Berlin' ), station_name => $station_name, nav_link => '/' . $station_name, ); diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index 63366a2..36f486b 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -6,6 +6,8 @@ package DBInfoscreen::Controller::Wagenreihung; use Mojo::Base 'Mojolicious::Controller'; +use utf8; + use Travel::Status::DE::DBWagenreihung; use Travel::Status::DE::DBWagenreihung::Wagon; @@ -24,11 +26,12 @@ sub zugbildung_db { my @wagons; - for my $wagon_number ( sort { $a <=> $b } keys %{ $details->{wagon} } ) { + for my $wagon ( @{ $details->{wagons} } ) { + my ( $wagon_type, $wagon_number ) = @{$wagon}; my %wagon = ( fahrzeugnummer => "", - fahrzeugtyp => $details->{wagon}{$wagon_number}, - kategorie => "", + fahrzeugtyp => $wagon_type, + kategorie => $wagon_type =~ m{^[0-9.]+$} ? 'LOK' : '', train_no => $train_no, wagenordnungsnummer => $wagon_number, positionamhalt => { @@ -56,10 +59,15 @@ sub zugbildung_db { my $train_type = $details->{raw}; $train_type =~ s{ - .* }{}x; + my $route_start = $details->{route}{start} // $details->{route}{preStart}; + my $route_end = $details->{route}{end} // $details->{route}{postEnd}; + my $route = "${route_start} → ${route_end}"; + $self->render( 'zugbildung_db', wr_error => undef, title => $train_type . ' ' . $train_no, + route => $route, zb => $details, train_no => $train_no, wagons => [@wagons], |