bug 3097: statistics on itemcount not working
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 8 Apr 2009 10:18:39 +0000 (12:18 +0200)
committerGalen Charlton <galen.charlton@liblime.com>
Sat, 6 Jun 2009 23:43:48 +0000 (18:43 -0500)
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>
reports/issues_stats.pl

index df848bd..63ea68e 100755 (executable)
@@ -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