Loading lib/Travelynx.pm +17 −1 Original line number Diff line number Diff line Loading @@ -2052,6 +2052,7 @@ sub startup { my ($tx) = @_; my $body = decode( 'utf-8', $tx->res->body ); my $json = JSON->new->decode($body); my @station_list; my @coordinate_list; for my $feature ( @{ $json->{polyline}{features} } ) { Loading @@ -2061,6 +2062,8 @@ sub startup { and $feature->{properties}{type} eq 'stop' ) { push( @{$coord}, $feature->{properties}{id} ); push( @station_list, $feature->{properties}{name} ); } push( @coordinate_list, $coord ); } Loading @@ -2073,8 +2076,21 @@ sub startup { }; $cache->freeze( $url, $ret ); my $iris_stations = join( '|', $train->route ); my $hafas_stations = join( '|', @station_list ); if ( $iris_stations ne $hafas_stations ) { $self->app->log->warn( 'Ignoring polyline for ' . $train->line . ": IRIS route does not agree with HAFAS route: $iris_stations != $hafas_stations" ); $promise->reject('polyline route mismatch'); } else { $promise->resolve($ret); } } )->catch( sub { my ($err) = @_; Loading Loading
lib/Travelynx.pm +17 −1 Original line number Diff line number Diff line Loading @@ -2052,6 +2052,7 @@ sub startup { my ($tx) = @_; my $body = decode( 'utf-8', $tx->res->body ); my $json = JSON->new->decode($body); my @station_list; my @coordinate_list; for my $feature ( @{ $json->{polyline}{features} } ) { Loading @@ -2061,6 +2062,8 @@ sub startup { and $feature->{properties}{type} eq 'stop' ) { push( @{$coord}, $feature->{properties}{id} ); push( @station_list, $feature->{properties}{name} ); } push( @coordinate_list, $coord ); } Loading @@ -2073,8 +2076,21 @@ sub startup { }; $cache->freeze( $url, $ret ); my $iris_stations = join( '|', $train->route ); my $hafas_stations = join( '|', @station_list ); if ( $iris_stations ne $hafas_stations ) { $self->app->log->warn( 'Ignoring polyline for ' . $train->line . ": IRIS route does not agree with HAFAS route: $iris_stations != $hafas_stations" ); $promise->reject('polyline route mismatch'); } else { $promise->resolve($ret); } } )->catch( sub { my ($err) = @_; Loading