diff options
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 12 | ||||
| -rw-r--r-- | lib/DBInfoscreen/Controller/Wagenreihung.pm | 2 | ||||
| -rw-r--r-- | templates/_train_details.html.ep | 2 | 
3 files changed, 12 insertions, 4 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index c4b3d08..7271d63 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -16,6 +16,7 @@ use List::MoreUtils qw();  use Mojo::JSON      qw(decode_json encode_json);  use Mojo::Promise;  use Mojo::UserAgent; +use Travel::Status::DE::DBWagenreihung;  use Travel::Status::DE::HAFAS;  use Travel::Status::DE::IRIS;  use Travel::Status::DE::IRIS::Stations; @@ -714,7 +715,16 @@ sub render_train {  		$self->wagonorder->get_p( $result->train_no, $departure->{wr_link} )  		  ->then(  			sub { -				# great! +				my ($wr_json) = @_; +				eval { +					my $wr +					  = Travel::Status::DE::DBWagenreihung->new( +						from_json => $wr_json ); +					$departure->{wr_text} = join( q{ + }, +						map { $_->{short} } +						grep { $_->{short} } $wr->train_descriptions ); +				}; +				$departure->{wr_text} ||= 'Wagen';  				return;  			},  			sub { diff --git a/lib/DBInfoscreen/Controller/Wagenreihung.pm b/lib/DBInfoscreen/Controller/Wagenreihung.pm index c821e11..5e5f653 100644 --- a/lib/DBInfoscreen/Controller/Wagenreihung.pm +++ b/lib/DBInfoscreen/Controller/Wagenreihung.pm @@ -16,8 +16,6 @@ use Travel::Status::DE::DBWagenreihung::Wagon;  sub get_zugbildung_db {  	my ( $self, $train_no ) = @_; -	say $train_no; -  	my $details = $self->app->train_details_db->{$train_no};  	if ( not $details ) { diff --git a/templates/_train_details.html.ep b/templates/_train_details.html.ep index 6e57b29..c89a01c 100644 --- a/templates/_train_details.html.ep +++ b/templates/_train_details.html.ep @@ -123,7 +123,7 @@  %       }  %     }  %     if ($departure->{wr_link}) { -        <a class="smallbutton" href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= l 'Wagen' %> +        <a class="smallbutton" href="/_wr/<%= $departure->{train_no} %>/<%= $departure->{wr_link} %>?e=<%= $departure->{direction} // '' %>"><i class="material-icons" aria-hidden="true">train</i> <%= $departure->{wr_text} || 'Wagen' %>          </a>  %     }  %     elsif ($icetype and $icetype->[2] and ($linetype eq 'fern' or $departure->{train_type} =~ m{NJ})) { | 
