diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2025-05-25 12:01:16 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2025-05-25 12:01:16 +0200 |
commit | 7844270322c4062817b0398ad2eb07a586fd5232 (patch) | |
tree | bb312d87eaf85f8cf2bf3e5708234ec245f7abda /lib/Travelynx.pm | |
parent | 3ebd7d5179136ed7ca652742d489fd9be2fd228f (diff) |
Get wagonorder description and designation from DBRIS::Formation2.11.34
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-x | lib/Travelynx.pm | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 6ae646d..aa48128 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -1100,7 +1100,7 @@ sub startup { if (@unknown_stations) { $self->app->log->warn( sprintf( -'Route of %s %s (%s -> %s) contains unknown stations: %s', +'IRIS: Route of %s %s (%s -> %s) contains unknown stations: %s', $train->type, $train->train_no, $train->origin, @@ -1467,35 +1467,41 @@ sub startup { my $data = {}; my $user_data = {}; - if ( $opt{is_departure} + my $wr; + eval { + $wr + = Travel::Status::DE::DBRIS::Formation->new( + json => $wagonorder ); + }; + + if ( $opt{is_departure} + and $wr and not exists $wagonorder->{error} ) { $data->{wagonorder_dep} = $wagonorder; $user_data->{wagongroups} = []; - for my $group ( @{ $wagonorder->{groups} // [] } ) { + for my $group ( $wr->groups ) { my @wagons; - for my $wagon ( @{ $group->{vehicles} // [] } ) - { + for my $wagon ( $group->carriages ) { push( @wagons, { - id => $wagon->{vehicleID}, - number => $wagon - ->{wagonIdentificationNumber}, - type => - $wagon->{type}{constructionType}, + id => $wagon->uic_id, + number => $wagon->number, + type => $wagon->type, } ); } push( @{ $user_data->{wagongroups} }, { - name => $group->{name}, - to => $group->{transport}{destination} - {name}, - type => $group->{transport}{category}, - no => $group->{transport}{number}, - wagons => [@wagons], + name => $group->name, + description => $group->description, + designation => $group->designation, + to => $group->destination, + type => $group->train_type, + no => $group->train_no, + wagons => [@wagons], } ); if ( $group->{name} |