Fix stats when there were no new subscription in the given range of dates
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 22 Apr 2007 22:28:42 +0000 (22:28 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 22 Apr 2007 22:28:42 +0000 (22:28 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1728 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/stats.php

index 591d18b..4887934 100644 (file)
@@ -77,9 +77,8 @@ class StatsModule extends PLModule
 
         // la première ligne contient le total des inscrits avant la date de départ (J - $jours)
         list(,$init_nb) = $res->next();
-        $total = $init_nb;
-
-        list($numjour, $nb) = $res->next();
+        $total    = $init_nb;
+        $numjour = - $jours - 1;
 
         for ($i = -$jours; $i<=0; $i++) {
             if ($numjour<$i) {
@@ -96,6 +95,7 @@ class StatsModule extends PLModule
         header( "Content-type: image/png");
 
         $delt = ($total - $init_nb)/10;
+        $delt = $delt ? $delt : 5;
         $ymin = round($init_nb - $delt,0);
         $ymax = round($total   + $delt,0);