summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm35
1 files changed, 9 insertions, 26 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index de1f5e5..5a8c44e 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -568,15 +568,12 @@ sub render_train {
$self->render_later;
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, $occupancy_req,
- $stationinfo_req, $route_req
- );
+ my @requests
+ = ( $wagonorder_req, $occupancy_req, $stationinfo_req, $route_req );
if ( $departure->{wr_link} ) {
$self->wagonorder->is_available_p( $result, $departure->{wr_link} )
@@ -595,30 +592,9 @@ sub render_train {
return;
}
)->wait;
-
- # Looks like utilization data is only available for long-distance trains
- # – and the few regional trains which also have wagon order data (e.g.
- # around Stuttgart). Funky.
- $self->marudor->get_train_utilization( train => $result )->then(
- sub {
- my ( $first, $second ) = @_;
- $departure->{utilization} = [ $first, $second ];
- return;
- },
- sub {
- $departure->{utilization} = undef;
- return;
- }
- )->finally(
- sub {
- $utilization_req->resolve;
- return;
- }
- )->wait;
}
else {
$wagonorder_req->resolve;
- $utilization_req->resolve;
}
$self->marudor->get_efa_occupancy(
@@ -702,6 +678,13 @@ sub render_train {
$departure->{trip_id} = $journey->id;
+ if ( my $load = $route_ts->{$station_name}{load} ) {
+ if ( %{$load} ) {
+ $departure->{utilization}
+ = [ $load->{FIRST}, $load->{SECOND} ];
+ }
+ }
+
# If a train number changes on the way, IRIS routes are incomplete,
# whereas HAFAS data has all stops -> merge HAFAS stops into IRIS
# stops. This is a rare case, one point where it can be observed is