Loading lib/Travelynx.pm +3 −1 Original line number Diff line number Diff line Loading @@ -1516,7 +1516,9 @@ sub startup { if ($has_arrived) { my @unknown_stations = $self->stations->grep_unknown( $train->route ); backend_id => $user->{backend_id}, names => [ $train->route ] ); if (@unknown_stations) { $self->app->log->warn( sprintf( Loading lib/Travelynx/Command/integritycheck.pm +6 −3 Original line number Diff line number Diff line Loading @@ -76,7 +76,8 @@ sub run { my %notified; my $rename = $self->app->renamed_station; my $res = $db->select( 'journeys', [ 'route', 'edited' ] )->expand; my $res = $db->select( 'journeys', [ 'backend_id', 'route', 'edited' ] ) ->expand; while ( my $j = $res->hash ) { if ( $j->{edited} & 0x0010 ) { Loading @@ -89,8 +90,10 @@ sub run { $stop->[0] = $rename->{ $stop->[0] }; } } my @unknown = $self->app->stations->grep_unknown( map { $_->[0] } @stops ); my @unknown = $self->app->stations->grep_unknown( backend_id => $j->{backend_id}, names => [ map { $_->[0] } @stops ] ); for my $stop_name (@unknown) { if ( not $notified{$stop_name} ) { if ( not $found ) { Loading lib/Travelynx/Model/Journeys.pm +10 −5 Original line number Diff line number Diff line Loading @@ -445,8 +445,12 @@ sub update { # Otherwise, fetch stop IDs so that polylines remain usable if ( @new_route != @{ $opt{route} } ) { my %stop_id = map { $_->{name} => $_->{eva} } $self->{stations}->get_by_names( @{ $opt{route} } ); my %stop_id = map { $_->{name} => $_->{eva} } $self->{stations}->get_by_names( backend_id => $journey->{backend_id}, names => [ $opt{route} ] ); @new_route = map { [ $_, $stop_id{$_}, {} ] } @{ $opt{route} }; } Loading Loading @@ -1268,9 +1272,10 @@ sub sanity_check { . ' Stimmt das wirklich?'; } if ( $journey->{edited} & 0x0010 and not $lax ) { my @unknown_stations = $self->{stations} ->grep_unknown( map { $_->[0] } @{ $journey->{route} } ); my @unknown_stations = $self->{stations}->grep_unknown( backend_id => $journey->{backend_id}, names => [ map { $_->[0] } @{ $journey->{route} } ] ); if (@unknown_stations) { return 'Unbekannte Station(en): ' . join( ', ', @unknown_stations ); } Loading lib/Travelynx/Model/Stations.pm +12 −7 Original line number Diff line number Diff line Loading @@ -461,11 +461,16 @@ sub get_by_name { # Slow sub get_by_names { my ( $self, @names ) = @_; my ( $self, %opt ) = @_; my @ret = $self->{pg}->db->select( 'stations', '*', { name => { '=', \@names } } ) ->hashes->each; my @ret = $self->{pg}->db->select( 'stations', '*', { name => { '=', $opt{names} }, source => $opt{backend_id} } )->hashes->each; return @ret; } Loading Loading @@ -506,10 +511,10 @@ sub search { # Slow sub grep_unknown { my ( $self, @stations ) = @_; my ( $self, %opt ) = @_; my %station = map { $_->{name} => 1 } $self->get_by_names(@stations); my @unknown_stations = grep { not $station{$_} } @stations; my %station = map { $_->{name} => 1 } $self->get_by_names(%opt); my @unknown_stations = grep { not $station{$_} } @{ $opt{names} }; return @unknown_stations; } Loading Loading
lib/Travelynx.pm +3 −1 Original line number Diff line number Diff line Loading @@ -1516,7 +1516,9 @@ sub startup { if ($has_arrived) { my @unknown_stations = $self->stations->grep_unknown( $train->route ); backend_id => $user->{backend_id}, names => [ $train->route ] ); if (@unknown_stations) { $self->app->log->warn( sprintf( Loading
lib/Travelynx/Command/integritycheck.pm +6 −3 Original line number Diff line number Diff line Loading @@ -76,7 +76,8 @@ sub run { my %notified; my $rename = $self->app->renamed_station; my $res = $db->select( 'journeys', [ 'route', 'edited' ] )->expand; my $res = $db->select( 'journeys', [ 'backend_id', 'route', 'edited' ] ) ->expand; while ( my $j = $res->hash ) { if ( $j->{edited} & 0x0010 ) { Loading @@ -89,8 +90,10 @@ sub run { $stop->[0] = $rename->{ $stop->[0] }; } } my @unknown = $self->app->stations->grep_unknown( map { $_->[0] } @stops ); my @unknown = $self->app->stations->grep_unknown( backend_id => $j->{backend_id}, names => [ map { $_->[0] } @stops ] ); for my $stop_name (@unknown) { if ( not $notified{$stop_name} ) { if ( not $found ) { Loading
lib/Travelynx/Model/Journeys.pm +10 −5 Original line number Diff line number Diff line Loading @@ -445,8 +445,12 @@ sub update { # Otherwise, fetch stop IDs so that polylines remain usable if ( @new_route != @{ $opt{route} } ) { my %stop_id = map { $_->{name} => $_->{eva} } $self->{stations}->get_by_names( @{ $opt{route} } ); my %stop_id = map { $_->{name} => $_->{eva} } $self->{stations}->get_by_names( backend_id => $journey->{backend_id}, names => [ $opt{route} ] ); @new_route = map { [ $_, $stop_id{$_}, {} ] } @{ $opt{route} }; } Loading Loading @@ -1268,9 +1272,10 @@ sub sanity_check { . ' Stimmt das wirklich?'; } if ( $journey->{edited} & 0x0010 and not $lax ) { my @unknown_stations = $self->{stations} ->grep_unknown( map { $_->[0] } @{ $journey->{route} } ); my @unknown_stations = $self->{stations}->grep_unknown( backend_id => $journey->{backend_id}, names => [ map { $_->[0] } @{ $journey->{route} } ] ); if (@unknown_stations) { return 'Unbekannte Station(en): ' . join( ', ', @unknown_stations ); } Loading
lib/Travelynx/Model/Stations.pm +12 −7 Original line number Diff line number Diff line Loading @@ -461,11 +461,16 @@ sub get_by_name { # Slow sub get_by_names { my ( $self, @names ) = @_; my ( $self, %opt ) = @_; my @ret = $self->{pg}->db->select( 'stations', '*', { name => { '=', \@names } } ) ->hashes->each; my @ret = $self->{pg}->db->select( 'stations', '*', { name => { '=', $opt{names} }, source => $opt{backend_id} } )->hashes->each; return @ret; } Loading Loading @@ -506,10 +511,10 @@ sub search { # Slow sub grep_unknown { my ( $self, @stations ) = @_; my ( $self, %opt ) = @_; my %station = map { $_->{name} => 1 } $self->get_by_names(@stations); my @unknown_stations = grep { not $station{$_} } @stations; my %station = map { $_->{name} => 1 } $self->get_by_names(%opt); my @unknown_stations = grep { not $station{$_} } @{ $opt{names} }; return @unknown_stations; } Loading