From e9f7a0dd1cef9e32ec6b93fa3cfed5711f84a64c Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 7 Nov 2019 18:49:12 +0000 Subject: [PATCH] Bug 22831: (follow-up) Sort results, group by db Signed-off-by: Bouzid Fergani Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- misc/maintenance/compare_es_to_db.pl | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/misc/maintenance/compare_es_to_db.pl b/misc/maintenance/compare_es_to_db.pl index d12a2e0995..35d391b66b 100644 --- a/misc/maintenance/compare_es_to_db.pl +++ b/misc/maintenance/compare_es_to_db.pl @@ -90,16 +90,34 @@ foreach my $index ( ('biblios','authorities') ){ my $opac_base = C4::Context->preference('OPACBaseURL'); - foreach my $problem (@diff){ + my @koha_problems; + my @es_problems; + foreach my $problem ( sort { $a <=> $b } @diff){ if ( (grep /^$problem$/, @db_records) ){ - print "Record $problem exists in Koha but not ES\n"; + push @koha_problems, $problem; + } else { + push @es_problems, $problem; + } + } + + if ( @koha_problems ){ + print "=================\n"; + print "Records that exist in Koha but not in ES\n"; + for my $problem ( @koha_problems ){ if ( $index eq 'biblios' ) { + print " #$problem"; print " Visit here to see record: $opac_base/cgi-bin/koha/opac-detail.pl?biblionumber=$problem\n"; } elsif ( $index eq 'authorities' ) { + print "#$problem"; print " Visit here to see record: $opac_base/cgi-bin/koha/opac-authoritiesdetail.pl?authid=$problem\n"; } - } else { - print "Record $problem exists in ES but not Koha\n"; + } + } + if ( @es_problems ){ + print "=================\n"; + print "Records that exist in ES but not in Koha\n"; + for my $problem ( @es_problems ){ + print " #$problem"; print " Enter this command to view record: curl $es_base/data/$problem?pretty=true\n"; } } -- 2.39.5