Minor improvement of keynote skin
[platal.git] / modules / stats.php
index 591d18b..6c9f501 100644 (file)
@@ -68,7 +68,7 @@ class StatsModule extends PLModule
                              TO_DAYS(date_ins)-TO_DAYS(NOW()),
                             ".(-($jours+1)).") AS jour,
                          COUNT(user_id) AS nb
-                   FROM  auth_user_md5 
+                   FROM  auth_user_md5
                   WHERE  perms IN ('admin','user')
                GROUP BY  jour");
 
@@ -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);
 
@@ -125,7 +125,7 @@ EOF2;
     {
         if ($promo == 'all') {
             // date de départ
-            $depart = 1920;
+            $depart = 1930;
 
             //recupere le nombre d'inscriptions par jour sur la plage concernée
             $res = XDB::iterRow(
@@ -164,7 +164,7 @@ set timefmt "%d/%m/%y"
 set xr [$depart:$fin]
 set yr [0:100]
 
-set title "Nombre d'inscrits par promotion depuis $depart."
+set title "Proportion d'inscrits par promotion depuis $depart, en %."
 
 plot "-" using 1:2 title 'inscrits' with boxes;
 {$inscrits}
@@ -188,7 +188,7 @@ EOF2;
                                  TO_DAYS(date_ins)-TO_DAYS(NOW()),
                                 ".(-($jours+1)).") AS jour,
                              COUNT(user_id) AS nb
-                       FROM  auth_user_md5 
+                       FROM  auth_user_md5
                       WHERE  promo = {?} AND perms IN ('admin','user')
                    GROUP BY  jour", $promo);