diff options
author | Daniel Friesel <derf@finalrewind.org> | 2023-01-09 19:42:41 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2023-01-09 19:42:41 +0100 |
commit | 8da6180bf186523af9aadd51ff5512a278f3e300 (patch) | |
tree | c75a9a0a6e3fd91131e9ee86f13ee07129af7bf3 /lib/DBInfoscreen/Controller | |
parent | 2ab551e913c56185d5888784453c18de376f56d6 (diff) |
readd ze zycles4.14.9
Diffstat (limited to 'lib/DBInfoscreen/Controller')
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 59b7748..5c282bd 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -814,12 +814,12 @@ sub render_train { = $self->app->train_details_db->{ $departure->{train_no} }; my @cycle_from; my @cycle_to; - for my $cycle ( values %{ $departure->{composition}->{cycle} // {} } ) { - push( @cycle_from, @{ $cycle->{from} // [] } ); - push( @cycle_to, @{ $cycle->{to} // [] } ); + for my $pred ( @{ $departure->{composition}{predecessors} // [] } ) { + push( @cycle_from, $pred->[1] ); + } + for my $succ ( @{ $departure->{composition}{successors} // [] } ) { + push( @cycle_to, $succ->[1] ); } - @cycle_from = sort { $a <=> $b } uniq @cycle_from; - @cycle_to = sort { $a <=> $b } uniq @cycle_to; $departure->{cycle_from} = [ map { [ $_, $self->app->train_details_db->{$_} ] } @cycle_from ]; $departure->{cycle_to} @@ -1059,6 +1059,25 @@ sub train_details { $res->{details} = [@him_details]; } + if ( $self->param('detailed') ) { + $res->{composition} + = $self->app->train_details_db->{ $res->{train_no} }; + my @cycle_from; + my @cycle_to; + for my $pred ( @{ $res->{composition}{predecessors} // [] } ) { + push( @cycle_from, $pred->[1] ); + } + for my $succ ( @{ $res->{composition}{successors} // [] } ) { + push( @cycle_to, $succ->[1] ); + } + $res->{cycle_from} + = [ map { [ $_, $self->app->train_details_db->{$_} ] } + @cycle_from ]; + $res->{cycle_to} + = [ map { [ $_, $self->app->train_details_db->{$_} ] } + @cycle_to ]; + } + $self->render( $self->param('ajax') ? '_train_details' : 'train_details', departure => $res, |