Bug 34666: Combine queries in _Findgroupreserve
authorNick Clemens <nick@bywatersolutions.com>
Wed, 30 Aug 2023 18:56:59 +0000 (18:56 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 8 Sep 2023 14:54:53 +0000 (11:54 -0300)
commit72bfb416d3725bd11dc4595ac429d4c510d6d3ee
treea7ab9f25b2a1a4eafd937d4b50cdb8f1c919793a
parent6f7ccdf6c3d4916ac19b7ace58068ff862a5ee24
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>
C4/Reserves.pm