diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-03-27 13:27:15 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-03-27 13:27:15 +0100 |
commit | aa9e55128f287b2e264df22997ec282b13f16fbe (patch) | |
tree | c7900bae91466f01fc280bf4f577460f8e281df9 /lib/DBInfoscreen/Controller | |
parent | 67c7349906ce6c9c93cc45f23046853f3ad07fbc (diff) |
request EFA occupancy data (works for some VRR trains)
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 8f868a9..169240d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -557,11 +557,14 @@ sub render_train { my $wagonorder_req = Mojo::Promise->new; my $utilization_req = Mojo::Promise->new; + my $occupancy_req = Mojo::Promise->new; my $stationinfo_req = Mojo::Promise->new; my $route_req = Mojo::Promise->new; - my @requests - = ( $wagonorder_req, $utilization_req, $stationinfo_req, $route_req ); + my @requests = ( + $wagonorder_req, $utilization_req, $occupancy_req, + $stationinfo_req, $route_req + ); if ( $departure->{wr_link} ) { $self->wagonorder->is_available_p( $result, $departure->{wr_link} ) @@ -606,6 +609,26 @@ sub render_train { $utilization_req->resolve; } + $self->marudor->get_efa_occupancy( + eva => $result->station_uic, + train_no => $result->train_no + )->then( + sub { + my ($occupancy) = @_; + $departure->{occupancy} = $occupancy; + return; + }, + sub { + $departure->{occupancy} = undef; + return; + } + )->finally( + sub { + $occupancy_req->resolve; + return; + } + )->wait; + $self->wagonorder->get_stationinfo_p( $result->station_uic )->then( sub { my ($station_info) = @_; |