From cc03452a6b45d592466e1f03ad5200b38df24da3 Mon Sep 17 00:00:00 2001
From: Rodolphe Quiedeville <rodolphe@quiedeville.org>
Date: Thu, 8 Dec 2005 14:14:20 +0000
Subject: [PATCH] Bugfix sur le calcul de la moyenne

---
 .../telephonie/script/graph-statistiques-tempsreels.php   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/htdocs/telephonie/script/graph-statistiques-tempsreels.php b/htdocs/telephonie/script/graph-statistiques-tempsreels.php
index 106ec8efc3d..cc20e1d0674 100644
--- a/htdocs/telephonie/script/graph-statistiques-tempsreels.php
+++ b/htdocs/telephonie/script/graph-statistiques-tempsreels.php
@@ -88,9 +88,7 @@ if ($resql)
 	    {
 	      $jour = (substr($rowa[0],0,2) * 1);
 	      $data[$jour] = ($rowa[1]/60);
-	      $total = $total + $data[$jour];
 	      $i++;
-	      $moydata[$jour] = $total / $i;
 	    }
 	}
 
@@ -101,8 +99,10 @@ if ($resql)
 	  $moydatas[$i] = 0;
 	  if ($data[$j])
 	    $datas[$i] = $data[$j];
-	  if ($moydata[$j])
-	    $moydatas[$i] = $moydata[$j];
+
+	  $total = $total + $datas[$i];
+	  $moydatas[$i] = $total / $j;
+
 	  $labels[$i] = $j;
 	}
       
-- 
GitLab