save all the wagon orders we can get

This commit is contained in:
Daniel Friesel 2019-12-19 20:16:10 +01:00
parent b0ddada5d1
commit e0a2b9aa26
2 changed files with 33 additions and 12 deletions

View file

@ -2192,7 +2192,6 @@ sub startup {
if ($is_departure) { if ($is_departure) {
$data->{wagonorder_dep} = $wagonorder; $data->{wagonorder_dep} = $wagonorder;
$user_data->{wagons} = [];
if ( exists $user_data->{wagongroups} ) { if ( exists $user_data->{wagongroups} ) {
$user_data->{wagongroups} = []; $user_data->{wagongroups} = [];
} }
@ -2203,11 +2202,12 @@ sub startup {
} }
) )
{ {
my @wagons;
for for
my $wagon ( @{ $group->{allFahrzeug} // [] } ) my $wagon ( @{ $group->{allFahrzeug} // [] } )
{ {
push( push(
@{ $user_data->{wagons} }, @wagons,
{ {
id => $wagon->{fahrzeugnummer}, id => $wagon->{fahrzeugnummer},
number => number =>
@ -2216,15 +2216,18 @@ sub startup {
} }
); );
} }
if ( $group->{fahrzeuggruppebezeichnung}
and $group->{fahrzeuggruppebezeichnung}
=~ m{ ^ ICE }x )
{
push( push(
@{ $user_data->{wagongroups} }, @{ $user_data->{wagongroups} },
$group->{fahrzeuggruppebezeichnung} {
); name =>
$group->{fahrzeuggruppebezeichnung},
from =>
$group->{startbetriebsstellename},
to => $group->{zielbetriebsstellename},
no => $group->{verkehrlichezugnummer},
wagons => [@wagons],
} }
);
} }
$db->update( $db->update(
'in_transit', 'in_transit',

View file

@ -188,7 +188,25 @@
% } % }
</td> </td>
</tr> </tr>
% if ($journey->{user_data} and $journey->{user_data}{wagons}) { % if ($journey->{user_data} and $journey->{user_data}{wagongroups} and not exists $journey->{user_data}{wagons}) {
<tr>
<th scope="row">Rollmaterial</th>
<td class="wagons">
% for my $wagongroup (@{$journey->{user_data}{wagongroups} // []}) {
Wagenverbund <%= $wagongroup->{name} %> von <%= $wagongroup->{from} %> nach <%= $wagongroup->{to} %> als <%= $journey->{type} %> <%= $wagongroup->{no} %><br/>
% for my $wagon (@{$wagongroup->{wagons}}) {
<span><%= substr($wagon->{id}, 0, 2) %></span><span><%= substr($wagon->{id}, 2, 2) %></span><span><%= substr($wagon->{id}, 4, 1) %></span><span class="wagonclass"><%= substr($wagon->{id}, 5, 3) %></span><span class="wagonnum"><%= substr($wagon->{id}, 8, 3) %></span><span class="checksum"><%= substr($wagon->{id}, 11) %></span>
%= $wagon->{type}
% if ($wagon->{number}) {
Wagen <%= $wagon->{number} %>
% }
<br/>
% }
% }
</td>
</tr>
% }
% elsif ($journey->{user_data} and $journey->{user_data}{wagons}) {
<tr> <tr>
<th scope="row">Rollmaterial</th> <th scope="row">Rollmaterial</th>
<td class="wagons"> <td class="wagons">