summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-03-03 16:11:48 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-03-03 16:11:48 +0100
commit5268be1cc6918a1793dab36140ac63d84b8ba05a (patch)
tree85515473f28594513cfd6befea0800c6ee1d9bab /lib/DBInfoscreen/Controller/Stationboard.pm
parent09531c474d341f4232e291a253ec3c7e2210070c (diff)
train details: show train type(s) in wagon order link if known
Diffstat (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm12
1 files changed, 11 insertions, 1 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 {