From d8a2f3d2700a0a8c96df23f54a1d115990f1fe5e Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 9 Dec 2014 15:10:57 -0500 Subject: [PATCH] LP#1386347 hard-coded queue stats for captured holds 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 --- Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm index a9dccb0f24..b853b427d8 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm @@ -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) { -- 2.11.0