Bugzilla – Attachment 159354 Details for
Bug 35432
Clarify and simplify the workings of MapItemsToHoldRequests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35432: Remove PULL_BRANCHES and use ifs over unless
Bug-35432-Remove-PULLBRANCHES-and-use-ifs-over-unl.patch (text/plain), 3.56 KB, created by
Nick Clemens (kidclamp)
on 2023-11-29 16:41:45 UTC
(
hide
)
Description:
Bug 35432: Remove PULL_BRANCHES and use ifs over unless
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-11-29 16:41:45 UTC
Size:
3.56 KB
patch
obsolete
>From 6925e6f6d3e5a5f79c6382bb2f9f45e09b6e4ac8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 29 Nov 2023 15:00:18 +0000 >Subject: [PATCH] Bug 35432: Remove PULL_BRANCHES and use ifs over unless > >PULL_BRANCHES and PULL_BRANCHES2 felt a little arbitrary, moved >to using a last in the outer loop. > >Swapped 'next unless' for an if to more directly show when we are acting >--- > C4/HoldsQueue.pm | 36 ++++++++++++++++++------------------ > 1 file changed, 18 insertions(+), 18 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index a27487f09c5..8fbab8fec95 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -585,24 +585,25 @@ sub MapItemsToHoldRequests { > } else { > $pull_branches = [keys %items_by_branch]; > } >+ $holdingbranch ||= $pull_branches->[0]; # We set this as the first from the list of pull branches >+ # unless we set it above to the pickupbranch or the least cost branch >+ # FIXME: The itention is to follow StaticHoldsQueueWeight, but we don't check that pref > > # Try picking items where the home and pickup branch match first >- PULL_BRANCHES: > foreach my $branch (@$pull_branches) { > my $holding_branch_items = $items_by_branch{$branch} >- or next; >+ or next; > >- $holdingbranch ||= $branch; # We set this as the first from the list of pull branches >- # unless we set it above to the pickupbranch or the least cost branch >- # FIXME: The itention is to follow StaticHoldsQueueWeight, but we don't check that pref > foreach my $item (@$holding_branch_items) { >- next if $pickup_branch ne $item->{homebranch}; >- next unless _can_item_fill_request( $item, $request, $libraries ); >- >- $itemnumber = $item->{itemnumber}; >- $holdingbranch = $branch; >- last PULL_BRANCHES; >+ if ( $pickup_branch eq $item->{homebranch} >+ && _can_item_fill_request( $item, $request, $libraries ) ) >+ { >+ $itemnumber = $item->{itemnumber}; >+ $holdingbranch = $branch; >+ last; >+ } > } >+ last if $itemnumber; > } > > # Now try items from the least cost branch based on the transport cost matrix or StaticHoldsQueueWeight >@@ -617,19 +618,18 @@ sub MapItemsToHoldRequests { > > # Now try for items for any item that can fill this hold > unless ( $itemnumber ) { >- PULL_BRANCHES2: > foreach my $branch (@$pull_branches) { > my $holding_branch_items = $items_by_branch{$branch} > or next; > > foreach my $item (@$holding_branch_items) { >- >- next unless _can_item_fill_request( $item, $request, $libraries ); >- >- $itemnumber = $item->{itemnumber}; >- $holdingbranch = $branch; >- last PULL_BRANCHES2; >+ if( _can_item_fill_request( $item, $request, $libraries ) ){ >+ $itemnumber = $item->{itemnumber}; >+ $holdingbranch = $branch; >+ last; >+ } > } >+ last if $itemnumber; > } > } > } >-- >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 35432
:
159351
|
159352
|
159353
|
159354
|
159355
|
159381
|
159382
|
159383
|
159384
|
159385
|
162194
|
162195
|
162196
|
162197
|
162198