From a69d5031d876220cafdea8221fcea092f53f52f6 Mon Sep 17 00:00:00 2001 From: Kelly McElligott Date: Mon, 14 Sep 2020 12:34:22 +0000 Subject: [PATCH] Bug 25760: (follow-up) Restore use of ceil The ceiling function here ensures that partial copies are counted as full copies i.e. if we need half a book to reach the ratio, we should report 1 book, not 0 Signed-off-by: Kelly McElligott --- circ/reserveratios.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circ/reserveratios.pl b/circ/reserveratios.pl index 322f2b3b0f..45af1bd419 100755 --- a/circ/reserveratios.pl +++ b/circ/reserveratios.pl @@ -157,7 +157,7 @@ $sth->execute(@query_params); my @reservedata; while ( my $data = $sth->fetchrow_hashref ) { my $thisratio = $data->{reservecount} / $data->{itemcount}; - my $ratiocalc = $data->{reservecount}/$ratio - $data->{itemcount}; + my $ratiocalc = ceil($data->{reservecount}/$ratio - $data->{itemcount}); $ratiocalc >= 0 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause push( @reservedata, -- 2.11.0