Bug 38126 - Holds queue is allocating holds twice when using TransportCostMatrix and LocalHoldsPriority
Summary: Holds queue is allocating holds twice when using TransportCostMatrix and Loca...
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Nick Clemens (kidclamp)
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
: 37594 (view as bug list)
Depends on: 35826
Blocks:
  Show dependency treegraph
 
Reported: 2024-10-08 18:10 UTC by Nick Clemens (kidclamp)
Modified: 2024-11-15 15:51 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00,24.05.05
Circulation function:


Attachments
Bug 38126: Skip allocated holds when filling from transport cost matrix (1.73 KB, patch)
2024-10-08 18:13 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 38126: Skip allocated holds when filling from transport cost matrix (1.80 KB, patch)
2024-10-09 11:08 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 38126: Skip allocated holds when filling from transport cost matrix (1.84 KB, patch)
2024-10-10 13:24 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 38126: Skip allocated holds when filling from transport cost matrix (1.90 KB, patch)
2024-10-11 14:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-10-08 18:10:32 UTC
In MapItemsToHoldRequests we first attempt to fill holds with local priority - if we find any we mark the request 'allocated' then pass remaining holds to _allocateWithTransportCostMatrix, however, that routine doesn't filter out allocated holds

To recreate:
1 - Enable RealTimeHoldsQueue
2 - Enable UseTransportCostMatrix
3 - Enable LocalHoldsPriority Give/Home/Home
4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
5 - Find a bib with a Centerville item
6 - Place a hold for a centerville patron
7 - Circulation - Holds queue - All libraries
8 - Note hold is entered twice
9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
Comment 1 Nick Clemens (kidclamp) 2024-10-08 18:13:12 UTC
Created attachment 172548 [details] [review]
Bug 38126: Skip allocated holds when filling from transport cost matrix

This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once
Comment 2 Kyle M Hall (khall) 2024-10-09 11:08:53 UTC
Created attachment 172568 [details] [review]
Bug 38126: Skip allocated holds when filling from transport cost matrix

This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 3 Brendan Lawlor 2024-10-10 13:24:38 UTC
Created attachment 172586 [details] [review]
Bug 38126: Skip allocated holds when filling from transport cost matrix

This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 4 Martin Renvoize (ashimema) 2024-10-11 14:52:41 UTC
Created attachment 172697 [details] [review]
Bug 38126: Skip allocated holds when filling from transport cost matrix

This patch simply weeds out allocated holds before filling from the matrix

To test:
 1 - Enable RealTimeHoldsQueue
 2 - Enable UseTransportCostMatrix
 3 - Enable LocalHoldsPriority Give/Home/Home
 4 - Administration - Transport cost matrix - enable transfers to/from Centreville and other libraries, add a cost, and save
 5 - Find a bib with a Centerville item
 6 - Place a hold for a centerville patron
 7 - Circulation - Holds queue - All libraries
 8 - Note hold is entered twice
 9 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
10 - Run holds queue again, still there twice
11 - Apply patch
12 - On command line:
    perl misc/cronjobs/holds/build_holds_queue.pl --force
    Confirm allocated only once
13 - Delete hold, place again from bib record (to test real time allocation)
14 - Confirm allocated only once

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Katrin Fischer 2024-10-16 12:37:35 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 6 Lucas Gass (lukeg) 2024-10-25 21:28:58 UTC
Backported to 24.05.x for upcoming 24.05.05
Comment 7 Nick Clemens (kidclamp) 2024-11-06 11:47:28 UTC
*** Bug 37594 has been marked as a duplicate of this bug. ***
Comment 8 Fridolin Somers 2024-11-15 15:51:34 UTC
Depends on Bug 35826 not in 23.11.x