Bugzilla – Attachment 128572 Details for
Bug 29702
all_libraries routine in library groups make a DB call per member of group
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29702: fetch group libraries in a single call
Bug-29702-fetch-group-libraries-in-a-single-call.patch (text/plain), 1.77 KB, created by
Nick Clemens (kidclamp)
on 2021-12-15 15:47:24 UTC
(
hide
)
Description:
Bug 29702: fetch group libraries in a single call
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-12-15 15:47:24 UTC
Size:
1.77 KB
patch
obsolete
>From a246a2ac93bd9f851dd6f571ee1e5042de1ea6e6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 15 Dec 2021 15:44:06 +0000 >Subject: [PATCH] Bug 29702: fetch group libraries in a single call > >The current code gets all group members, then loops through and fetches the library if there is a >branchcode, or recursively calls itself if a group. This slows down performance. > >We can utilize the 'libraries' method to get all child libraries at once, then make a check >for child groups separately > >To recreate: > 1 - Add 100 items to a biblio > 2 - Define a library group as a hold group > 3 - Add all libraries to the group > 4 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Any library' > 5 - place a hold on the record and note load time after patron is selected > 6 - Set 'Default checkout, hold and return policy'->'Hold pickup library match' = 'Patrons hold group' > 7 - place a hold, note longer load time after patron selection > 8 - Apply patch > 9 - note improvement >10 - prove -v t/db_dependent/Koha/Libraries.t >--- > Koha/Library/Group.pm | 10 +++------- > 1 file changed, 3 insertions(+), 7 deletions(-) > >diff --git a/Koha/Library/Group.pm b/Koha/Library/Group.pm >index aaf68530d5..b203bdf3d7 100644 >--- a/Koha/Library/Group.pm >+++ b/Koha/Library/Group.pm >@@ -144,14 +144,10 @@ sub all_libraries { > > my @libraries; > >- my @children = $self->children; >+ push (@libraries, $self->libraries); >+ my @children = $self->children->search({branchcode=>undef}); > foreach my $c (@children) { >- if ( $c->branchcode ) { >- push( @libraries, $c->library ); >- } >- else { >- push( @libraries, $c->all_libraries ); >- } >+ push( @libraries, $c->all_libraries ); > } > > my %seen; >-- >2.20.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 29702
:
128572
|
128843
|
129116