Bugzilla – Attachment 111464 Details for
Bug 26657
"Unlinked" output of LinkBibHeadingsToAuthorities is ambiguous
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26657: Differentiate between unlinked and not linked
Bug-26657-Differentiate-between-unlinked-and-not-l.patch (text/plain), 3.56 KB, created by
David Cook
on 2020-10-12 00:36:01 UTC
(
hide
)
Description:
Bug 26657: Differentiate between unlinked and not linked
Filename:
MIME Type:
Creator:
David Cook
Created:
2020-10-12 00:36:01 UTC
Size:
3.56 KB
patch
obsolete
>From eff594200dd9ef5aea5792ede65d46fa55dae446 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Mon, 12 Oct 2020 00:21:03 +0000 >Subject: [PATCH] Bug 26657: Differentiate between unlinked and not linked > >This patch differentiates between unlinked (a linkage is removed) >and not linked (there is no linkage) in the output of >LinkBibHeadingsToAuthorities. > >Test plan: >0. Use koha-testing-docker >1. koha-shell -c "./misc/link_bibs_to_authorities.pl -l --test" kohadev >2. Note 436 bibs checked, 1315 headings linked, 678 headings not linked > >(Previously, the "not linked" headings would have been under > the "unlinked" category.) >--- > C4/Biblio.pm | 2 +- > misc/link_bibs_to_authorities.pl | 23 +++++++++++++++++++++++ > 2 files changed, 24 insertions(+), 1 deletion(-) > >diff --git a/C4/Biblio.pm b/C4/Biblio.pm >index 6b7e78e05b..67ef54389e 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -608,7 +608,7 @@ sub LinkBibHeadingsToAuthorities { > } > } > else { >- $results{'unlinked'}->{ $heading->display_form() }++; >+ $results{'nonlinked'}->{ $heading->display_form() }++; > } > } > >diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl >index 9044292185..d66d5ca455 100755 >--- a/misc/link_bibs_to_authorities.pl >+++ b/misc/link_bibs_to_authorities.pl >@@ -75,6 +75,7 @@ my $num_bad_bibs = 0; > my %unlinked_headings; > my %linked_headings; > my %fuzzy_headings; >+my %nonlinked_headings; > my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; > process_bibs( $linker, $bib_limit, $auth_limit, $commit ); >@@ -108,9 +109,11 @@ sub process_bibs { > > my $headings_linked = 0; > my $headings_unlinked = 0; >+ my $headings_nonlinked = 0; > my $headings_fuzzy = 0; > for ( values %linked_headings ) { $headings_linked += $_; } > for ( values %unlinked_headings ) { $headings_unlinked += $_; } >+ for ( values %nonlinked_headings ) { $headings_nonlinked += $_; } > for ( values %fuzzy_headings ) { $headings_fuzzy += $_; } > > my $endtime = time(); >@@ -132,6 +135,7 @@ Number of bibs with errors: $num_bad_bibs > Number of headings linked: $headings_linked > Number of headings unlinked: $headings_unlinked > Number of headings fuzzily linked: $headings_fuzzy >+Number of headings not linked: $headings_nonlinked > _SUMMARY_ > $summary .= "\n**** Ran in test mode only ****\n" if $test_only; > print $summary; >@@ -180,6 +184,22 @@ _FUZZY_HEADER_ > foreach my $key (@keys) { > print "$key:\t" . $fuzzy_headings{$key} . " occurrences\n"; > } >+ >+ print <<_NONLINKED_HEADER_; >+ >+Not linked headings (from most frequent to least): >+------------------------------------------------------- >+ >+_NONLINKED_HEADER_ >+ >+ @keys = sort { >+ $nonlinked_headings{$b} <=> $nonlinked_headings{$a} >+ or "\L$a" cmp "\L$b" >+ } keys %nonlinked_headings; >+ foreach my $key (@keys) { >+ print "$key:\t" . $nonlinked_headings{$key} . " occurrences\n"; >+ } >+ > print $summary; > } > } >@@ -203,6 +223,9 @@ sub process_bib { > foreach my $key ( keys %{ $results->{'unlinked'} } ) { > $unlinked_headings{$key} += $results->{'unlinked'}->{$key}; > } >+ foreach my $key ( keys %{ $results->{'nonlinked'} } ) { >+ $nonlinked_headings{$key} += $results->{'nonlinked'}->{$key}; >+ } > foreach my $key ( keys %{ $results->{'linked'} } ) { > $linked_headings{$key} += $results->{'linked'}->{$key}; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26657
: 111464