From c8665d794a20948aec59ea200be75e137369811f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 Jun 2020 13:46:11 +0200 Subject: [PATCH] Bug 25760: (bug 15422 follow-up) Display record with hold ratio == 1 If the hold ratio is 1 (ie. number of holds == number of copies), we should display it if it's the value in the filter. Test plan: 1. Create bibliographic records with 1, 2 and 3 items 2. Place 1 hold on each of them 3. Go to the Hold ratios report and search with ratio = 1, 2 then 3 4. Place another hold on each of the record 5. Repeat 3 6. Make sure there is no regression in the test plan of bug 15422 --- circ/reserveratios.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 77117934d0..e34d1ab445 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -158,8 +158,8 @@ $sth->execute(@query_params); my @reservedata; while ( my $data = $sth->fetchrow_hashref ) { my $thisratio = $data->{reservecount} / $data->{itemcount}; - my $ratiocalc = ceil($data->{reservecount}/$ratio - $data->{itemcount}); - $ratiocalc >= 1 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause + my $ratiocalc = $data->{reservecount}/$ratio - $data->{itemcount}; + $ratiocalc >= 0 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause push( @reservedata, { @@ -183,7 +183,7 @@ while ( my $data = $sth->fetchrow_hashref ) { itype => [split('\|', $data->{l_itype})], reservecount => $data->{reservecount}, itemcount => $data->{itemcount}, - ratiocalc => sprintf( "%.0d", $ratiocalc ), + ratiocalc => sprintf( "%d", $ratiocalc ), thisratio => sprintf( "%.2f", $thisratio ), thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0, listcall => [split('\|', $data->{listcall})] -- 2.20.1