@@ -, +, @@ ratio == 1 --- circ/reserveratios.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/circ/reserveratios.pl +++ a/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})] --