Make the estimated hold queue position method aware of the cut_in_line field
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Jun 2010 16:24:55 +0000 (16:24 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 14 Jun 2010 16:24:55 +0000 (16:24 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16711 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm

index 1cf8756..6d0f20a 100644 (file)
@@ -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' => [