Skip to content
...@@ -518,7 +518,14 @@ sub handle_request { ...@@ -518,7 +518,14 @@ sub handle_request {
( $status->station ? $status->station->{name} : $station ), ( $status->station ? $status->station->{name} : $station ),
}; };
if ( $status->station and $status->station->{names} ) { # Travel::Status::DE::HAFAS mis-detects ÖBB station names
if ( $hafas
and $hafas eq 'ÖBB'
and @{ $status->station->{names} // [] } > 1 )
{
$data->{station_name} = $station;
}
elsif ( $status->station and $status->station->{names} ) {
$data->{station_name} $data->{station_name}
= List::Util::reduce { length($a) < length($b) ? $a : $b } = List::Util::reduce { length($a) < length($b) ? $a : $b }
@{ $status->station->{names} }; @{ $status->station->{names} };
...@@ -1180,7 +1187,8 @@ sub train_details { ...@@ -1180,7 +1187,8 @@ sub train_details {
my $train_type = $res->{train_type} = $journey->type // q{}; my $train_type = $res->{train_type} = $journey->type // q{};
my $train_no = $res->{train_no} = $journey->number // q{}; my $train_no = $res->{train_no} = $journey->number // q{};
$res->{train_line} = $journey->line_no // q{}; $res->{train_line} = $journey->line_no // q{};
$self->stash( title => "${train_type} ${train_no}" ); $self->stash( title => $train_type . ' '
. ( $train_no || $res->{train_line} ) );
} }
if ( not defined $journey->class ) { if ( not defined $journey->class ) {
......