Bugzilla – Attachment 116375 Details for
Bug 24488
Holds to Pull sometimes shows the wrong 'first patron' details
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24488: perf - Move holds search out of the loop
Bug-24488-perf---Move-holds-search-out-of-the-loop.patch (text/plain), 2.46 KB, created by
Marcel de Rooy
on 2021-02-05 10:29:43 UTC
(
hide
)
Description:
Bug 24488: perf - Move holds search out of the loop
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2021-02-05 10:29:43 UTC
Size:
2.46 KB
patch
obsolete
>From b3bc4ff636c9363e42b8c2e053c870c0bba1af67 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 18 Nov 2020 11:45:41 +0100 >Subject: [PATCH] Bug 24488: perf - Move holds search out of the loop >Content-Type: text/plain; charset=utf-8 > >This will need attention from QA. >We are assuming that the hold with the highest priority has priority=1 > >Signed-off-by: Michal Denar <black23@gmail.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > circ/pendingreserves.pl | 32 +++++++++++++++++++++++++------- > 1 file changed, 25 insertions(+), 7 deletions(-) > >diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl >index 69477bf6da..b7b362fb71 100755 >--- a/circ/pendingreserves.pl >+++ b/circ/pendingreserves.pl >@@ -156,6 +156,7 @@ unless ( $enddate ) { > # building query parameters > my %where = ( > 'reserve.found' => undef, >+ 'reserve.priority' => 1, > 'reserve.suspend' => 0, > 'itembib.itemlost' => 0, > 'itembib.withdrawn' => 0, >@@ -222,6 +223,29 @@ my $patrons_count = { > } > }; > >+my $holds_biblios_map = { >+ map { $_->{biblionumber} => $_->{reserve_id} } @{ Koha::Holds->search( >+ {%where}, >+ { >+ join => ['itembib', 'biblio'], >+ alias => 'reserve', >+ select => ['reserve.biblionumber', 'reserve.reserve_id'], >+ } >+ )->unblessed >+ } >+}; >+ >+my $all_holds = { >+ map { $_->biblionumber => $_ } @{ Koha::Holds->search( >+ { reserve_id => [ values %$holds_biblios_map ]}, >+ { >+ prefetch => [ 'borrowernumber', 'itembib', 'biblio' ], >+ alias => 'reserve', >+ } >+ )->as_list >+ } >+}; >+ > # make final holds_info array and fill with info > my @holds_info; > foreach my $bibnum ( @biblionumbers ){ >@@ -275,13 +299,7 @@ foreach my $bibnum ( @biblionumbers ){ > $hold_info->{pull_count} = $pull_count; > > # get other relevant information >- my $res_info = Koha::Holds->search( >- { 'reserve.biblionumber' => $bibnum, %where }, >- { prefetch => [ 'borrowernumber', 'itembib', 'biblio' ], >- order_by => 'priority', >- alias => 'reserve' >- } >- )->next; # get first item in results >+ my $res_info = $all_holds->{$bibnum}; > $hold_info->{patron} = $res_info->patron; > $hold_info->{item} = $res_info->item; > $hold_info->{biblio} = $res_info->biblio; >-- >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 24488
:
97773
|
106379
|
106882
|
107206
|
107213
|
111341
|
111342
|
111343
|
111347
|
111348
|
111349
|
111350
|
111358
|
111359
|
111360
|
111361
|
111362
|
112815
|
112816
|
112817
|
112818
|
112819
|
113695
|
113696
|
113697
|
113698
|
113699
|
113700
|
113756
|
113757
|
113763
|
113764
|
113774
|
113775
|
113776
|
113777
|
113778
|
113798
|
113829
|
113830
|
113831
|
113832
|
113833
|
113834
|
113835
|
113836
|
113837
|
113838
|
113839
|
113840
|
113841
|
113842
|
113850
|
113851
|
113852
|
113853
|
113854
|
113855
|
113856
|
113857
|
113858
|
113859
|
113860
|
113861
|
113862
|
113863
|
113864
|
114835
|
114836
|
114837
|
114838
|
114839
|
114840
|
114841
|
114842
|
114843
|
114844
|
114845
|
114846
|
114847
|
114848
|
114849
|
114850
|
116362
|
116363
|
116364
|
116365
|
116366
|
116367
|
116368
|
116369
|
116370
|
116371
|
116372
|
116373
|
116374
| 116375 |
116376
|
116377
|
116384