From 65a90c602cfa4baa195b3a18c529559f81c29c38 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 12 Apr 2024 19:58:49 +0200 Subject: HAFAS->station: ÖBB needs special handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Travel/Status/DE/HAFAS.pm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'lib/Travel') diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm index a20d157..2cf642a 100644 --- a/lib/Travel/Status/DE/HAFAS.pm +++ b/lib/Travel/Status/DE/HAFAS.pm @@ -1104,10 +1104,19 @@ sub station { my %prefc_by_loc; - for my $i ( 0 .. $#locL ) { - my $loc = $locL[$i]; - if ( $loc->{pRefL} ) { - $prefc_by_loc{$i} = $#{ $loc->{pRefL} }; + if ( $self->{active_service} and $self->{active_service} eq 'ÖBB' ) { + for my $jny ( @{ $self->{raw_json}{svcResL}[0]{res}{jnyL} // [] } ) { + if ( defined $jny->{stbStop}{locX} ) { + $prefc_by_loc{ $jny->{stbStop}{locX} } += 1; + } + } + } + else { + for my $i ( 0 .. $#locL ) { + my $loc = $locL[$i]; + if ( $loc->{pRefL} ) { + $prefc_by_loc{$i} = $#{ $loc->{pRefL} }; + } } } -- cgit v1.2.3