Bugzilla – Attachment 166825 Details for
Bug 35836
search_for_data_inconsistencies.pl - Search for loops in dependencies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35836: (follow-up) optimize the script when searching for guarantors
Bug-35836-follow-up-optimize-the-script-when-searc.patch (text/plain), 5.26 KB, created by
Hammat wele
on 2024-05-16 12:58:10 UTC
(
hide
)
Description:
Bug 35836: (follow-up) optimize the script when searching for guarantors
Filename:
MIME Type:
Creator:
Hammat wele
Created:
2024-05-16 12:58:10 UTC
Size:
5.26 KB
patch
obsolete
>From ac39712d253c6efd404cc5fd4f3684bd0c96ae9e Mon Sep 17 00:00:00 2001 >From: Hammat Wele <hammat.wele@inlibro.com> >Date: Thu, 16 May 2024 12:57:53 +0000 >Subject: [PATCH] Bug 35836: (follow-up) optimize the script when searching for > guarantors > >--- > .../search_for_data_inconsistencies.pl | 47 +++++++++---------- > 1 file changed, 23 insertions(+), 24 deletions(-) > >diff --git a/misc/maintenance/search_for_data_inconsistencies.pl b/misc/maintenance/search_for_data_inconsistencies.pl >index a37ff3634c..6719cecedc 100755 >--- a/misc/maintenance/search_for_data_inconsistencies.pl >+++ b/misc/maintenance/search_for_data_inconsistencies.pl >@@ -328,18 +328,17 @@ use C4::Biblio qw( GetMarcFromKohaField ); > > { > my @loop_borrowers_relationships; >- my $relationships = Koha::Patron::Relationships->search(); >- my @patrons_guarantors = Koha::Patron::Relationships::guarantors($relationships)->as_list; >- my @patrons_guarantees = Koha::Patron::Relationships::guarantees($relationships)->as_list; >+ my @guarantor_ids = Koha::Patron::Relationships->_resultset->get_column('guarantor_id')->all(); >+ my @guarantee_ids = Koha::Patron::Relationships->_resultset->get_column('guarantee_id')->all(); > >- foreach my $patron_guarantor (@patrons_guarantors) { >- foreach my $patron_guarantee (@patrons_guarantees) { >- if ( $patron_guarantor->borrowernumber == $patron_guarantee->borrowernumber ) { >+ foreach my $guarantor_id (@guarantor_ids) { >+ foreach my $guarantee_id (@guarantee_ids) { >+ if ( $guarantor_id == $guarantee_id ) { > >- my $guarantor_id; >- my $guarantee_id; >+ my $relation_guarantor_id; >+ my $relation_guarantee_id; > my $size_list; >- my $tmp_garantor_id = $patron_guarantor->borrowernumber; >+ my $tmp_garantor_id = $guarantor_id; > my @guarantor_ids; > > do { >@@ -353,45 +352,45 @@ use C4::Biblio qw( GetMarcFromKohaField ); > $size_list = scalar @relationship_for_go; > > foreach my $relation (@relationship_for_go) { >- $guarantor_id = $relation->guarantor_id; >- unless ( grep { $_ == $guarantor_id } @guarantor_ids ) { >- push @guarantor_ids, $guarantor_id; >+ $relation_guarantor_id = $relation->guarantor_id; >+ unless ( grep { $_ == $relation_guarantor_id } @guarantor_ids ) { >+ push @guarantor_ids, $relation_guarantor_id; > } >- $guarantee_id = $relation->guarantee_id; >+ $relation_guarantee_id = $relation->guarantee_id; > > my @relationship_for_go = Koha::Patron::Relationships->search( > { > -or => [ >- 'guarantor_id' => { '=', $guarantee_id }, >+ 'guarantor_id' => { '=', $relation_guarantee_id }, > ] > }, > )->as_list; > $size_list = scalar @relationship_for_go; > >- if ( $patron_guarantor->borrowernumber == $guarantee_id ) { >+ if ( $guarantor_id == $relation_guarantee_id ) { > last; > } > > foreach my $relation (@relationship_for_go) { >- $guarantor_id = $relation->guarantor_id; >- unless ( grep { $_ == $guarantor_id } @guarantor_ids ) { >- push @guarantor_ids, $guarantor_id; >+ $relation_guarantor_id = $relation->guarantor_id; >+ unless ( grep { $_ == $relation_guarantor_id } @guarantor_ids ) { >+ push @guarantor_ids, $relation_guarantor_id; > } >- $guarantee_id = $relation->guarantee_id; >+ $relation_guarantee_id = $relation->guarantee_id; > >- if ( $patron_guarantor->borrowernumber == $guarantee_id ) { >+ if ( $guarantor_id == $relation_guarantee_id ) { > last; > } > } >- if ( $patron_guarantor->borrowernumber == $guarantee_id ) { >+ if ( $guarantor_id == $relation_guarantee_id ) { > last; > } > } > >- $tmp_garantor_id = $guarantee_id; >- } while ( $patron_guarantor->borrowernumber != $guarantee_id && $size_list > 0 ); >+ $tmp_garantor_id = $relation_guarantee_id; >+ } while ( $guarantor_id != $relation_guarantee_id && $size_list > 0 ); > >- if ( $patron_guarantor->borrowernumber == $guarantee_id ) { >+ if ( $guarantor_id == $relation_guarantee_id ) { > unless ( grep { join( "", sort @$_ ) eq join( "", sort @guarantor_ids ) } > @loop_borrowers_relationships ) > { >-- >2.34.1
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 35836
:
161249
|
161307
|
161351
|
161836
|
161837
|
161838
|
161839
|
161840
|
161841
|
161842
|
161843
|
161844
|
162284
|
162341
|
162344
|
163368
|
164817
|
164818
|
166751
|
166752
| 166825