SVN: toys/stbr/stats/daily.php

shadzik shadzik at pld-linux.org
Sun Jan 3 14:21:49 CET 2010


Author: shadzik
Date: Sun Jan  3 14:21:49 2010
New Revision: 11089

Modified:
   toys/stbr/stats/daily.php
Log:
- we don't always have a full dataset, don't assume data we don't have yet is 0, rather don't display it at all


Modified: toys/stbr/stats/daily.php
==============================================================================
--- toys/stbr/stats/daily.php	(original)
+++ toys/stbr/stats/daily.php	Sun Jan  3 14:21:49 2010
@@ -25,10 +25,21 @@
 foreach ($pld_lines as $line) {
 	foreach($days as $day) {
 		$q = @$DBhandle->query('select count(*) from application where line="' . $line . '" and date >="'.$year.'-' . (string)$month . '-'.$day.' 00:00:00" and date < "'.$year.'-'. (string)$month .'-'.$day.' 23:59:59"');
-		if ($line == "th")
-			$thm[] = (int)$q->fetchSingle();
-		else
-			$tim[] = (int)$q->fetchSingle();
+		$data = (int)$q->fetchSingle();
+		switch($line) {
+			case "th":
+				if ($data == 0)
+					$thm[] = null;
+				else
+					$thm[] = $data;
+				break;
+			case "ti":
+				if ($data == 0)
+					$tim[] = null;
+				else
+					$tim[] = $data;
+				break;
+		}
 	}
 }
 


More information about the pld-cvs-commit mailing list