From 83fdae2c47289d837832286d4684fdd5b493b6c8 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 13 Apr 2024 19:05:13 +0200 Subject: train details: always get details from HAFAS Journey object --- lib/DBInfoscreen/Controller/Stationboard.pm | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 54390d6..9657bc0 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1170,20 +1170,26 @@ sub train_details { $res->{trip_id} = $journey->id; $res->{date} = $route->[0]{sched_dep} // $route->[0]{dep}; - if ( not $res->{train_type} ) { - my $train_type = $res->{train_type} = $journey->type // q{}; - my $train_no = $res->{train_no} = $journey->number // q{}; - $res->{train_line} = $journey->line_no // q{}; - $self->stash( title => $train_type . ' ' - . ( $train_no || $res->{train_line} ) ); + my $product = $journey->product; + + if ( my $req_name = $self->param('highlight') ) { + if ( my $p = $journey->product_at($req_name) ) { + $product = $p; + } } - if ( not defined $journey->class ) { + my $train_type = $res->{train_type} = $product->type // q{}; + my $train_no = $res->{train_no} = $product->number // q{}; + $res->{train_line} = $product->line_no // q{}; + $self->stash( title => $train_type . ' ' + . ( $train_no || $res->{train_line} ) ); + + if ( not defined $product->class ) { $linetype = 'ext'; } else { my $prod - = $self->class_to_product($hafas_obj)->{ $journey->class } + = $self->class_to_product($hafas_obj)->{ $product->class } // q{}; if ( $prod eq 'ice' or $prod eq 'ic_ec' ) { $linetype = 'fern'; -- cgit v1.2.3