Bug 34666: Combine queries in _Findgroupreserve
authorNick Clemens <nick@bywatersolutions.com>
Wed, 30 Aug 2023 18:56:59 +0000 (18:56 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 8 Sep 2023 19:40:54 +0000 (09:40 -1000)
commit7aa6464c239873cb52dee11fd079280eea944b62
tree07f6763709c060c2881dd771069cdc40a3635d49
parent91d9a154850a7a2fa9a1d233c555262a01ecef18
Bug 34666: Combine queries in _Findgroupreserve

The queries here are the same except for 2 differences:
1 - They check if the hold was on a particular item
2 - The latter confirms that the reserve item group matches the item's item group

For 1, it doesn't matter - only 1 item can be mapped ot a reserve, itemnumber is the primary key
for hold_fill_targets - so we are either matching it in the first query or the second, either way we get the same
reserve - the returns are the same so we don't care which query it came from

For 2, this has already been checked when the queue was built. We don't need to verify the match because
it wouldn't be in the targets if they didn't match

To test:
1 - Apply second unit test patch
2 - prove t/db_dependent/Reserves.t
3 - It should pass
4 - Apply this patch
5 - prove t/db_dependent/Reserves.t
6 - It continues to pass

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 72bfb416d3725bd11dc4595ac429d4c510d6d3ee)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Reserves.pm