Unverified Commit 65a90c60 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

HAFAS->station: ÖBB needs special handling

parent 757cf4d3
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -1104,12 +1104,21 @@ sub station {

	my %prefc_by_loc;

	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} };
			}
		}
	}

	my @prefcounts = sort { $b->[1] <=> $a->[1] }
	  map { [ $_, $prefc_by_loc{$_} ] } keys %prefc_by_loc;