bug 3097: statistics on itemcount not working

replacing issues.itemnumber by statistics.itemnumber
since issues was not included in the query.
All statistics on circulation for item count were zeroed.

[RM note: specifically, this patch fixes the results
 when you set the 'cell value' to 'count unique items']

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Henri-Damien LAURENT 2009-04-08 12:18:39 +02:00 committed by Galen Charlton
parent c90dd8b512
commit 89b537273d

View file

@ -426,12 +426,12 @@ sub calculate {
my $strcalc = "SELECT $linefield, $colfield, ";
$strcalc .= ($process == 1) ? " COUNT(*) " :
($process == 2) ? "(COUNT(DISTINCT borrowers.borrowernumber))" :
($process == 3) ? "(COUNT(DISTINCT issues.itemnumber))" : '';
($process == 3) ? "(COUNT(DISTINCT statistics.itemnumber))" : '';
if ($process == 4) {
my $rqbookcount = $dbh->prepare("SELECT count(*) FROM items");
$rqbookcount->execute;
my ($bookcount) = $rqbookcount->fetchrow;
$strcalc .= "100*(COUNT(DISTINCT issues.itemnumber))/ $bookcount " ;
$strcalc .= "100*(COUNT(DISTINCT statistics.itemnumber))/ $bookcount " ;
}
$strcalc .= "
FROM statistics