|
Lines 158-165
$sth->execute(@query_params);
Link Here
|
| 158 |
my @reservedata; |
158 |
my @reservedata; |
| 159 |
while ( my $data = $sth->fetchrow_hashref ) { |
159 |
while ( my $data = $sth->fetchrow_hashref ) { |
| 160 |
my $thisratio = $data->{reservecount} / $data->{itemcount}; |
160 |
my $thisratio = $data->{reservecount} / $data->{itemcount}; |
| 161 |
my $ratiocalc = ceil($data->{reservecount}/$ratio - $data->{itemcount}); |
161 |
my $ratiocalc = $data->{reservecount}/$ratio - $data->{itemcount}; |
| 162 |
$ratiocalc >= 1 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause |
162 |
$ratiocalc >= 0 or next; # TODO: tighter targeting -- get ratio limit into SQL using HAVING clause |
| 163 |
push( |
163 |
push( |
| 164 |
@reservedata, |
164 |
@reservedata, |
| 165 |
{ |
165 |
{ |
|
Lines 183-189
while ( my $data = $sth->fetchrow_hashref ) {
Link Here
|
| 183 |
itype => [split('\|', $data->{l_itype})], |
183 |
itype => [split('\|', $data->{l_itype})], |
| 184 |
reservecount => $data->{reservecount}, |
184 |
reservecount => $data->{reservecount}, |
| 185 |
itemcount => $data->{itemcount}, |
185 |
itemcount => $data->{itemcount}, |
| 186 |
ratiocalc => sprintf( "%.0d", $ratiocalc ), |
186 |
ratiocalc => sprintf( "%d", $ratiocalc ), |
| 187 |
thisratio => sprintf( "%.2f", $thisratio ), |
187 |
thisratio => sprintf( "%.2f", $thisratio ), |
| 188 |
thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0, |
188 |
thisratio_atleast1 => ( $thisratio >= 1 ) ? 1 : 0, |
| 189 |
listcall => [split('\|', $data->{listcall})] |
189 |
listcall => [split('\|', $data->{listcall})] |
| 190 |
- |
|
|