diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2021-01-11 22:09:00 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2021-01-11 22:09:00 +0100 | 
| commit | dcdea4247b6457202ce746814ff44d249c32d8b5 (patch) | |
| tree | 3b009ca49536d257e736d714a84fee142cdbc914 /lib/DBInfoscreen/Controller | |
| parent | d7376340ed10f412caefad198dfb2bac40448bbb (diff) | |
train details: show cycle (if available)
Diffstat (limited to 'lib/DBInfoscreen/Controller')
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 25 | 
1 files changed, 23 insertions, 2 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 9bb09b1..2eb7b12 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -560,6 +560,9 @@ sub render_train {  	my $stationinfo_req = Mojo::Promise->new;  	my $route_req       = Mojo::Promise->new; +	my @requests +	  = ( $wagonorder_req, $utilization_req, $stationinfo_req, $route_req ); +  	if ( $departure->{wr_link} ) {  		$self->wagonorder->is_available_p( $result, $departure->{wr_link} )  		  ->then( @@ -769,9 +772,27 @@ sub render_train {  		}  	)->wait; +	if ( $self->param('detailed') ) { +		my $cycle_req = Mojo::Promise->new; +		push( @requests, $cycle_req ); +		$self->wagonorder->has_umlauf_p( $result->train_no )->then( +			sub { +				$departure->{has_cycle} = 1; +			} +		)->catch( +			sub { +				# nop +			} +		)->finally( +			sub { +				$cycle_req->resolve; +				return; +			} +		)->wait; +	} +  	# Defer rendering until all requests have completed -	Mojo::Promise->all( $wagonorder_req, $utilization_req, $stationinfo_req, -		$route_req )->then( +	Mojo::Promise->all(@requests)->then(  		sub {  			$self->render(  				$template // '_train_details', | 
