From: phasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 14 Jun 2010 16:24:55 +0000 (+0000)
Subject: Make the estimated hold queue position method aware of the cut_in_line field
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3b19d14e778e52c823e36c01d5e4562e61ed00a9;p=evergreen%2Ftadl.git

Make the estimated hold queue position method aware of the cut_in_line field

git-svn-id: svn://svn.open-ils.org/ILS/trunk@16711 dcc99617-32d9-48b4-a31d-7c20da2025e4
---

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
index 1cf8756a9d..6d0f20ab09 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
@@ -1029,14 +1029,24 @@ sub retrieve_hold_queue_status_impl {
     # accomodate holds that currently have no potential copies
     my $q_holds = $e->json_query({
 
-        # fetch request_time since it's in the order_by and we're asking for distinct values
-        select => {ahr => ['id', 'request_time']},
+        # fetch cut_in_line and request_time since they're in the order_by
+        # and we're asking for distinct values
+        select => {ahr => ['id', 'cut_in_line', 'request_time']},
         from   => {
             ahr => {
                 ahcm => {type => 'left'} # there may be no copy maps 
             }
         },
-        order_by => {ahr => ['request_time']},
+        order_by => [
+            {
+                "class" => "ahr",
+                "field" => "cut_in_line",
+                "transform" => "coalesce",
+                "params" => [ 0 ],
+                "direction" => "desc"
+            },
+            { "class" => "ahr", "field" => "request_time" }
+        ],
         distinct => 1,
         where    => {
             '-or' => [