LP#1792429: calculate queue position in correct order
authorGalen Charlton <gmc@equinoxinitiative.org>
Thu, 13 Sep 2018 18:25:05 +0000 (14:25 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 13 Sep 2018 21:45:41 +0000 (17:45 -0400)
This patch ensures that the relative hold queue position
displayed in the webstaff Hold Shelf and Record -> View Holds
interfaces is calculated in the correct order, i.e., (cut-in-line aside)
with holds requested earlier having a lower queue position than
holds requested later.

To test
-------
[1] Set up a bib with a number of hold requests.
[2] Under Record -> Viwe Holds, note that the queue
    positions are reversed, with later holds having lower
    queue positions.
[3] Apply the patch and repeat step #2. This time, the queue
    positions should be correct.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Signed-off-by: Bill Erickson <berickxx@gmail.com>

Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm

index 238746c..3c69f33 100644 (file)
@@ -2302,7 +2302,7 @@ SELECT  h.id, h.request_time, h.capture_time, h.fulfillment_time, h.checkin_time
 
         ROW_NUMBER() OVER (
             PARTITION BY r.bib_record
-            ORDER BY h.cut_in_line DESC NULLS LAST, h.request_time DESC
+            ORDER BY h.cut_in_line DESC NULLS LAST, h.request_time ASC
         ) AS relative_queue_position,
 
         EXTRACT(EPOCH FROM COALESCE(