Loading lib/Travelynx/Command/integritycheck.pm +126 −108 Original line number Diff line number Diff line Loading @@ -9,10 +9,13 @@ use List::Util qw(); use Travel::Status::DE::IRIS::Stations; sub run { my ($self) = @_; my ( $self, $mode ) = @_; my $found = 0; my $db = $self->app->pg->db; if ( $mode eq 'all' or $mode eq 'unknown-evas' ) { my %notified; my $res1 = $db->query( qq{ select checkin_station_id Loading @@ -21,7 +24,6 @@ sub run { where stations.eva is null; } ); my $res2 = $db->query( qq{ select checkout_station_id Loading @@ -31,7 +33,6 @@ sub run { } ); my %notified; while ( my $row = $res1->hash ) { my $eva = $row->{checkin_station_id}; if ( not $found ) { Loading Loading @@ -63,6 +64,7 @@ sub run { $notified{$eva} = 1; } } } if ($found) { say '------------8<----------'; Loading @@ -70,9 +72,12 @@ sub run { $found = 0; } my $rename = $self->app->renamed_station; if ( $mode eq 'all' or $mode eq 'unknown-route-entries' ) { my %notified; my $rename = $self->app->renamed_station; my $res = $db->select( 'journeys', [ 'route', 'edited' ] )->expand; while ( my $j = $res->hash ) { if ( $j->{edited} & 0x0010 ) { next; Loading @@ -91,8 +96,10 @@ sub run { if ( not $found ) { say 'Journeys in the travelynx database contain the following unknown route entries.'; say 'Note that this check ignores manual route entries.'; say 'All reports refer to routes obtained via HAFAS/IRIS.'; say 'Note that this check ignores manual route entries.'; say 'All reports refer to routes obtained via HAFAS/IRIS.'; say '------------8<----------'; say 'Travel::Status::DE::IRIS v' . $Travel::Status::DE::IRIS::Stations::VERSION; Loading @@ -103,6 +110,7 @@ sub run { } } } } if ($found) { say '------------8<----------'; Loading @@ -110,11 +118,14 @@ sub run { $found = 0; } $res = $db->select( if ( $mode eq 'all' or $mode eq 'checkout-eva-vs-route-eva' ) { my $res = $db->select( 'journeys_str', [ 'journey_id', 'sched_arr_ts', 'route', 'arr_name', 'arr_eva' ], { backend_id => 0 } )->expand; journey: while ( my $j = $res->hash ) { my $found_in_route; my $found_arr; Loading Loading @@ -152,4 +163,11 @@ sub run { } } if ($found) { say '------------8<----------'; say ''; $found = 0; } } 1; Loading
lib/Travelynx/Command/integritycheck.pm +126 −108 Original line number Diff line number Diff line Loading @@ -9,10 +9,13 @@ use List::Util qw(); use Travel::Status::DE::IRIS::Stations; sub run { my ($self) = @_; my ( $self, $mode ) = @_; my $found = 0; my $db = $self->app->pg->db; if ( $mode eq 'all' or $mode eq 'unknown-evas' ) { my %notified; my $res1 = $db->query( qq{ select checkin_station_id Loading @@ -21,7 +24,6 @@ sub run { where stations.eva is null; } ); my $res2 = $db->query( qq{ select checkout_station_id Loading @@ -31,7 +33,6 @@ sub run { } ); my %notified; while ( my $row = $res1->hash ) { my $eva = $row->{checkin_station_id}; if ( not $found ) { Loading Loading @@ -63,6 +64,7 @@ sub run { $notified{$eva} = 1; } } } if ($found) { say '------------8<----------'; Loading @@ -70,9 +72,12 @@ sub run { $found = 0; } my $rename = $self->app->renamed_station; if ( $mode eq 'all' or $mode eq 'unknown-route-entries' ) { my %notified; my $rename = $self->app->renamed_station; my $res = $db->select( 'journeys', [ 'route', 'edited' ] )->expand; while ( my $j = $res->hash ) { if ( $j->{edited} & 0x0010 ) { next; Loading @@ -91,8 +96,10 @@ sub run { if ( not $found ) { say 'Journeys in the travelynx database contain the following unknown route entries.'; say 'Note that this check ignores manual route entries.'; say 'All reports refer to routes obtained via HAFAS/IRIS.'; say 'Note that this check ignores manual route entries.'; say 'All reports refer to routes obtained via HAFAS/IRIS.'; say '------------8<----------'; say 'Travel::Status::DE::IRIS v' . $Travel::Status::DE::IRIS::Stations::VERSION; Loading @@ -103,6 +110,7 @@ sub run { } } } } if ($found) { say '------------8<----------'; Loading @@ -110,11 +118,14 @@ sub run { $found = 0; } $res = $db->select( if ( $mode eq 'all' or $mode eq 'checkout-eva-vs-route-eva' ) { my $res = $db->select( 'journeys_str', [ 'journey_id', 'sched_arr_ts', 'route', 'arr_name', 'arr_eva' ], { backend_id => 0 } )->expand; journey: while ( my $j = $res->hash ) { my $found_in_route; my $found_arr; Loading Loading @@ -152,4 +163,11 @@ sub run { } } if ($found) { say '------------8<----------'; say ''; $found = 0; } } 1;