diff options
author | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-04-12 19:58:49 +0200 |
---|---|---|
committer | Birte Kristina Friesel <birte.friesel@uos.de> | 2024-04-12 19:58:49 +0200 |
commit | 65a90c602cfa4baa195b3a18c529559f81c29c38 (patch) | |
tree | ace9376ce648f92f8c018fbcd88ac42319ae7c66 | |
parent | 757cf4d3e34f62a2f18e695ff6bd46c818c15298 (diff) |
HAFAS->station: ÖBB needs special handling
-rw-r--r-- | lib/Travel/Status/DE/HAFAS.pm | 17 |
1 files changed, 13 insertions, 4 deletions
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} }; + } } } |