Bug 29483: Check ItemsAnyAvailableAndNotRestricted once per patron
authorNick Clemens <nick@bywatersolutions.com>
Mon, 15 Nov 2021 13:54:00 +0000 (13:54 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 20 Apr 2022 07:25:51 +0000 (21:25 -1000)
commit68c92b49d12f4e16fb6679835cc04eeda8c51633
tree6ee0bd9c1b7787c8eb015f15ef6f57ad19c2e113
parent4113f765b6fd4d62d8aa3ae86de5e0f4987b227e
Bug 29483: Check ItemsAnyAvailableAndNotRestricted once per patron

ItemsAnyAvailableAndNotRestricted can take a long time and create nested loops.
We can check it once per patron, however, this requires us to flip the loops.
Since an item can only be used once, we now add a check to see if this item has already
been assigned to a borrower.

To test:
1 - Find or create a biblio with 100 items
2 - Place ten 'Next available' holds on a biblio
3 - Set preference 'AllowRenewalIfOtherItemsAvailable' to 'Allow'
    Set circ rules 'On shelf holds allowed' to 'If any unavailable'
4 - Checkout one of the items to a patron, backdated to be overdue
5 - Note a long loading time for the patron's checkouts
6 - Apply patch, restart_all
7 - Patron loads much faster

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Circulation.pm