Unverified Commit 78442703 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Get wagonorder description and designation from DBRIS::Formation

parent 3ebd7d51
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -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,34 +1467,40 @@ sub startup {
						my $data      = {};
						my $user_data = {};

						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},
										name        => $group->name,
										description => $group->description,
										designation => $group->designation,
										to          => $group->destination,
										type        => $group->train_type,
										no          => $group->train_no,
										wagons      => [@wagons],
									}
								);
+5 −5
Original line number Diff line number Diff line
@@ -173,7 +173,7 @@
				</div>
			% }
			% if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {
				<div style="margin-bottom: 2ex;">
				<div style="margin-top: 2ex;">
					<ul>
						% for my $message (reverse @{$journey->{messages} // []}) {
							% if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
@@ -187,7 +187,7 @@
				</div>
			% }
			% if (@{$journey->{extra_data}{him_msg} // []}) {
				<div style="margin-bottom: 2ex;">
				<div style="margin-top: 2ex;">
					<ul>
						% for my $message (@{$journey->{extra_data}{him_msg} // []}) {
							% if (not stash('from_timeline') or $message->{prio} and $message->{prio} eq 'HOCH') {
@@ -198,13 +198,13 @@
				</div>
			% }
			% if ( @{$journey->{wagongroups} // []} and not stash('from_timeline')) {
				<div class="wagons" style="margin-bottom: 2ex;">
				<div class="wagons" style="margin-top: 2ex;">
					Wagen:<br/>
					%= include '_wagons', wagongroups => $journey->{wagongroups};
				</div>
			% }
			% if (not stash('from_timeline')) {
				<div>
				<div style="margin-top: 2ex;">
					Zuglauf:<br/>
					% my $before = 1;
					% my $within = 0;
@@ -213,7 +213,7 @@
						% if (($station->[1] and $station->[1] == $journey->{dep_eva}) or $station->[0] eq $journey->{dep_name}) {
							% $within = 1; $at_startstop = 1;
						% }
						% elsif (($station->[1] and $station->[1] == $journey->{arr_eva}) or $station->[0] eq $journey->{arr_name}) {
						% elsif ($journey->{arr_eva} and ($station->[1] and $station->[1] == $journey->{arr_eva}) or $station->[0] eq $journey->{arr_name}) {
							% $within = 0; $at_startstop = 1;
						% }
						% else {
+5 −2
Original line number Diff line number Diff line
% for my $wagongroup (@{$wagongroups // []}) {
	<%= $wagongroup->{name} %>
	%= $wagongroup->{description} // $wagongroup->{name}
	% my ($wagon_number) = ($wagongroup->{name} =~ m{ ^ ICE 0* (\d+) $ }x);
	% if ($wagon_number and my $group_name = app->ice_name->{$wagon_number}) {
	% if ($wagongroup->{designation}) {
		„<%= $wagongroup->{designation} %>“
	% }
	% elsif ($wagon_number and my $group_name = app->ice_name->{$wagon_number}) {
		„<%= $group_name %>“
	% }
	als <b><%= $wagongroup->{type} // $journey->{type} %> <%= $wagongroup->{no} %></b>