Revert "LP#1386347 hard-coded queue stats for captured holds"
authorBill Erickson <berickxx@gmail.com>
Thu, 15 Jan 2015 20:54:16 +0000 (15:54 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Return to calculating queue position for captured holds from the
copy map instead of assuming queue position 1.

This reverts commit 23171c7debf33f71ef0d59d2f8b3cdebc8a08f9f.

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

index 7d405ab..4c40d2f 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 = $hold->capture_time ? [] :$e->json_query({
+    my $q_holds = $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,14 +1417,12 @@ sub retrieve_hold_queue_status_impl {
 
 
     my $qpos = 1;
-    if (!$hold->capture_time) {
-        for my $h (@$q_holds) {
-            last if $h->{id} == $hold->id;
-            $qpos++;
-        }
+    for my $h (@$q_holds) {
+        last if $h->{id} == $hold->id;
+        $qpos++;
     }
 
-    my $hold_data = $hold->capture_time ? [] : $e->json_query({
+    my $hold_data = $e->json_query({
         select => {
             acp => [ {column => 'id', transform => 'count', aggregate => 1, alias => 'count'} ],
             ccm => [ {column =>'avg_wait_time'} ]
@@ -1464,7 +1462,6 @@ sub retrieve_hold_queue_status_impl {
         $num_potentials += $count;
     }
 
-    $num_potentials = 1 if $hold->capture_time;
     my $estimated_wait = -1;
 
     if($num_potentials) {