Bug 34666: Combine queries in _Findgroupreserve
authorNick Clemens <nick@bywatersolutions.com>
Wed, 30 Aug 2023 18:56:59 +0000 (18:56 +0000)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Fri, 15 Sep 2023 10:08:28 +0000 (10:08 +0000)
commitd37987ce83ae11312bdbcc1207b7ad1d37f772f4
tree1fd28ef29cf55b03c5c83dabc162550344146980
parent133267e18f10c2dba6dbaa69124bda8919b63f69
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>
(cherry picked from commit 7aa6464c239873cb52dee11fd079280eea944b62)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
C4/Reserves.pm