diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2022-10-31 16:37:32 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2022-10-31 16:37:32 +0100 | 
| commit | 2a55a8f7c6b5a8d3b8619b5014389d9ad2c99937 (patch) | |
| tree | 6ddeb37aedc7723d9dfefd3d933730f2c3bd6c48 /lib/DBInfoscreen/Controller | |
| parent | 0ffd106e689f7accd78c6f401f7a56d83bd75a97 (diff) | |
train details: show operator and additional HIM messages
Diffstat (limited to 'lib/DBInfoscreen/Controller')
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 24 | 
1 files changed, 21 insertions, 3 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 735cbe7..c2a5f80 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -676,7 +676,8 @@ sub render_train {  		sub {  			my ( $route_ts, $journey ) = @_; -			$departure->{trip_id} = $journey->id; +			$departure->{trip_id}  = $journey->id; +			$departure->{operator} = $journey->operator;  			if ( my $load = $route_ts->{$station_name}{load} ) {  				if ( %{$load} ) { @@ -755,8 +756,14 @@ sub render_train {  			}  			my @him_messages; +			my @him_details;  			for my $message ( $journey->messages ) { -				if ( not $message->code ) { +				if ( $message->code ) { +					push( @him_details, +						[ $message->short // q{}, { text => $message->text } ] +					); +				} +				else {  					push( @him_messages,  						[ $message->short // q{}, { text => $message->text } ]  					); @@ -775,6 +782,7 @@ sub render_train {  				$m->[0] =~ s{(?!<)->}{ → };  			}  			unshift( @{ $departure->{moreinfo} }, @him_messages ); +			unshift( @{ $departure->{details} },  @him_details );  		}  	)->catch(  		sub { @@ -1010,6 +1018,7 @@ sub train_details {  			$res->{origin}      = $journey->route_start;  			$res->{destination} = $journey->route_end; +			$res->{operator}    = $journey->operator;  			$res->{route_post_diff}  			  = [ map { { name => $_->{name} } } $journey->route ]; @@ -1020,8 +1029,14 @@ sub train_details {  			}  			my @him_messages; +			my @him_details;  			for my $message ( $journey->messages ) { -				if ( not $message->code ) { +				if ( $message->code ) { +					push( @him_details, +						[ $message->short // q{}, { text => $message->text } ] +					); +				} +				else {  					push( @him_messages,  						[ $message->short // q{}, { text => $message->text } ]  					); @@ -1041,6 +1056,9 @@ sub train_details {  			if (@him_messages) {  				$res->{moreinfo} = [@him_messages];  			} +			if (@him_details) { +				$res->{details} = [@him_details]; +			}  			$self->render(  				$self->param('ajax') ? '_train_details' : 'train_details', | 
