[Angstrom-devel] Koen Kooi : narcissus: only display graphs of machines that had builds in the selected timeframe

Angstrom Git Repos ang-git at xora.vm.bytemark.co.uk
Wed May 11 11:43:39 CEST 2011


Module: narcissus
Branch: master
Commit: f7248be11dccd925616a5b0d090070d84a4ea750

Author: Koen Kooi <koen at dominion.thruhere.net>
Date:   Wed May 11 11:43:22 2011 +0200

narcissus: only display graphs of machines that had builds in the selected timeframe

Signed-off-by: Koen Kooi <koen at dominion.thruhere.net>

---

 graph.php |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/graph.php b/graph.php
index 0ae8aa3..98eb398 100644
--- a/graph.php
+++ b/graph.php
@@ -75,6 +75,7 @@ for ($i = 0 ; $i <= $timeframe ; $i++) {
 			$buildcount = $builds[$machine][$statsdate];
 			$yvars[$machine] .= "[ $i, $buildcount ], \n";
 			if($maxbuilds < $builds[$machine][$statsdate]) $maxbuilds = $builds[$machine][$statsdate];
+			$didbuild[$machine] = 1;
 		} else {
 			$yvars[$machine] .= "[ $i, 0 ], \n";
 		}
@@ -109,7 +110,8 @@ function drawGraph() {
 	if(!isset($selectedmachine)) {
 	foreach($builds as $machine => $foo) {
 		$machineyvars = $yvars[$machine];
-		print("
+		if($didbuild[$machine] == 1) {
+			print("
 			  var layout = new PlotKit.Layout(\"bar\", options);
 			  layout.addDataset(\"$machine usage count\", [$machineyvars]);
 			  layout.evaluate();
@@ -120,6 +122,7 @@ function drawGraph() {
 			  var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout, {});
 			  plotter.render();
 			  ");
+		}
 	}
 	} else {
         $machine = $selectedmachine;
@@ -151,7 +154,7 @@ Statistics for the online image builder, number of builds per day<br>
 
     if(!isset($selectedmachine)) {
 		foreach ($builds as $machine => $foo) {
-			print("<div class='item'><table align=left><td><br>$machine<br><div id='div-$machine'><canvas id='graph-$machine'></canvas></div></td></table></div>\n");
+			if($didbuild[$machine] == 1) print("<div class='item'><table align=left><td><br>$machine<br><div id='div-$machine'><canvas id='graph-$machine'></canvas></div></td></table></div>\n");
 		}
 	} else {
 		print("<div class='item'><table align=left><td><br>$selectedmachine<br><div id='div-$machine'><canvas id='graph-$selectedmachine'></canvas></div></td></table></div>\n");




More information about the Angstrom-distro-devel mailing list