Bugzilla – Attachment 143999 Details for
Bug 32247
Real time HoldsQueue does not need to check items if there are no holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32247: Exit holds queue builder if there are no holds on the biblio
Bug-32247-Exit-holds-queue-builder-if-there-are-no.patch (text/plain), 3.01 KB, created by
Nick Clemens (kidclamp)
on 2022-11-17 13:40:46 UTC
(
hide
)
Description:
Bug 32247: Exit holds queue builder if there are no holds on the biblio
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-11-17 13:40:46 UTC
Size:
3.01 KB
patch
obsolete
>From 2753b3f43b89b424864e06b6f558aba06e08abfe Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 17 Nov 2022 13:38:58 +0000 >Subject: [PATCH] Bug 32247: Exit holds queue builder if there are no holds on > the biblio > >update_queue_for_biblio currently >1 - gets the holds on a bib >2 - gets the items available to fill any holds >3 - combines these to build the queue, exiting if there are no holds or items > >If there are no holds at step 1, we don't need to do step 2 or 3 >This patch simply deletes the queue for this biblio, then exits if there are no holds > >To test: >prove -v t/db_dependent/Reserves.t t/db_dependent/Koha/Item.t t/db_dependent/Koha/Hold.t t/db_dependent/Koha/BackgroundJobs/BatchDeleteItem.t t/db_dependent/Koha/BackgroundJobs/BatchDeleteBiblio.t t/db_dependent/HoldsQueue.t t/db_dependent/Circulation_holdsqueue.t t/db_dependent/Biblio_holdsqueue.t t/db_dependent/Biblio.t >--- > C4/HoldsQueue.pm | 28 +++++++++++++++------------- > 1 file changed, 15 insertions(+), 13 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 00afb4bdcb..2b86409e6e 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -931,8 +931,21 @@ are allowed to be passed to avoid calculating them many times inside loops. > > sub update_queue_for_biblio { > my ($args) = @_; >- > my $biblio_id = $args->{biblio_id}; >+ my $result; >+ >+ # FIXME This option is always set, is there ever a case where we want to update the queue, but not empty it? >+ if ( $args->{delete} ) { >+ my $dbh = C4::Context->dbh; >+ >+ $dbh->do("DELETE FROM tmp_holdsqueue WHERE biblionumber=$biblio_id"); >+ $dbh->do("DELETE FROM hold_fill_targets WHERE biblionumber=$biblio_id"); >+ } >+ >+ my $hold_requests = GetPendingHoldRequestsForBib($biblio_id); >+ $result->{requests} = scalar( @{$hold_requests} ); >+ # No need to check anything else if there are no holds to fill >+ return $result unless $result->{requests}; > > my $branches_to_use = $args->{branches_to_use} // load_branches_to_pull_from( C4::Context->preference('UseTransportCostMatrix') ); > my $transport_cost_matrix; >@@ -944,20 +957,9 @@ sub update_queue_for_biblio { > $transport_cost_matrix = $args->{transport_cost_matrix}; > } > >- if ( $args->{delete} ) { >- my $dbh = C4::Context->dbh; >- >- $dbh->do("DELETE FROM tmp_holdsqueue WHERE biblionumber=$biblio_id"); >- $dbh->do("DELETE FROM hold_fill_targets WHERE biblionumber=$biblio_id"); >- } >- >- my $hold_requests = GetPendingHoldRequestsForBib($biblio_id); > my $available_items = GetItemsAvailableToFillHoldRequestsForBib( $biblio_id, $branches_to_use ); > >- my $result = { >- requests => scalar( @{$hold_requests} ), >- available_items => scalar( @{$available_items} ), >- }; >+ $result->{available_items} = scalar( @{$available_items} ); > > my $item_map = MapItemsToHoldRequests( $hold_requests, $available_items, $branches_to_use, $transport_cost_matrix ); > $result->{mapped_items} = scalar( keys %{$item_map} ); >-- >2.30.2
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 32247
:
143999
|
144001
|
144040
|
144613