LP#1386347 hard-coded queue stats for captured holds
authorBill Erickson <berickxx@gmail.com>
Tue, 9 Dec 2014 20:10:57 +0000 (15:10 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Return queue position = 1 and # potential copies = 1 for captured
holds.  This change is a result of the fact that captured holds no
longer retain their potential copies list, so the queue calculation can
no longer take place for potential copies (plus it speeds up queue calc
for potential copies).

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm

index a9dccb0..b853b42 100644 (file)
@@ -1381,7 +1381,7 @@ sub retrieve_hold_queue_status_impl {
     # least one potential copy with the context hold, plus any holds that
     # share the same hold type and target.  The latter part exists to
     # accomodate holds that currently have no potential copies
-    my $q_holds = $e->json_query({
+    my $q_holds = $hold->capture_time ? [] :$e->json_query({
 
         # fetch cut_in_line and request_time since they're in the order_by
         # and we're asking for distinct values
@@ -1417,12 +1417,14 @@ sub retrieve_hold_queue_status_impl {
 
 
     my $qpos = 1;
-    for my $h (@$q_holds) {
-        last if $h->{id} == $hold->id;
-        $qpos++;
+    if (!$hold->capture_time) {
+        for my $h (@$q_holds) {
+            last if $h->{id} == $hold->id;
+            $qpos++;
+        }
     }
 
-    my $hold_data = $e->json_query({
+    my $hold_data = $hold->capture_time ? [] : $e->json_query({
         select => {
             acp => [ {column => 'id', transform => 'count', aggregate => 1, alias => 'count'} ],
             ccm => [ {column =>'avg_wait_time'} ]
@@ -1462,6 +1464,7 @@ sub retrieve_hold_queue_status_impl {
         $num_potentials += $count;
     }
 
+    $num_potentials = 1 if $hold->capture_time;
     my $estimated_wait = -1;
 
     if($num_potentials) {