From 487730311eba243ce2df77ca2310be954bc48811 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 Signed-off-by: Kelly McElligott --- circ/reserveratios.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index c673e869ed..322f2b3b0f 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -157,8 +157,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, { @@ -182,7 +182,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.11.0