Bug 30847: Cleanup calculation of holds and rank
authorNick Clemens <nick@bywatersolutions.com>
Wed, 25 May 2022 13:23:26 +0000 (13:23 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Wed, 31 Aug 2022 11:47:23 +0000 (08:47 -0300)
commit1ff61868b6633bf65a65dc28f581a6ebf645c460
tree8b8a3862a7e968933ece36d3e87acd2b798ad15f
parent5fe49c7db1113026d242ad081c6b100fc8bae76e
Bug 30847: Cleanup calculation of holds and rank

Currently we loop over all the holds on the record to get a count of the reserves not
waiting and a rank for the upcoming hold

We can simply count the number of nont waiting holds and add 1

Note: Before this patch the count of holds included the new hold we were going to place
which meant rank and count were the same. I believe countaing existing holds and our
upcoming rank is the correct behavior

To test:
 1 - Set OPACShowHoldQueueDetails system preference to 'Show holds and their priorty level'
 2 - Place a few holds on a bib on the staff side
 3 - Mark 1 waiting
 4 - Attempt to place hold on the bib on the opac
 5 - Note 'Your priority' and 'Number of holds' are the same number
 6 - Place another hold, confirm both increase
 7 - Set another hold waiting, confirm both decrease
 8 - Apply patch
 9 - Confirm 'Your priority' is now 1 greater than Number of holds
10 - Place a hold, set a hold waiting, confirm numbers adjust as appropriate

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
opac/opac-reserve.pl