Make it possible to view multiple modes together (for FFOS).w

This commit is contained in:
Hannes Verschore 2014-11-28 06:46:17 -08:00
Родитель 04ad55450f
Коммит 8da45ec3dd
2 изменённых файлов: 61 добавлений и 14 удалений

Просмотреть файл

@ -20,7 +20,6 @@ $results = mysql_query($query);
if (!$results || mysql_num_rows($results) != 1) if (!$results || mysql_num_rows($results) != 1)
die(); die();
$row = mysql_fetch_array($results); $row = mysql_fetch_array($results);
$runId = $row[0];
$overview["machine"] = $machine; $overview["machine"] = $machine;
$overview["stamp"] = $row[1]; $overview["stamp"] = $row[1];
$overview["suiteVersion"] = $suiteVersion; $overview["suiteVersion"] = $suiteVersion;
@ -36,16 +35,37 @@ if (!has_permissions()) {
die(); die();
} }
$query = "SELECT id, mode_id FROM `awfy_build` // Get all modes.
WHERE run_id = $runId"; $query = "SELECT mode_id
FROM `awfy_build`
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE machine = $machine
GROUP BY mode_id";
$results = mysql_query($query); $results = mysql_query($query);
if (!$results || mysql_num_rows($results) < 1) if (!$results || mysql_num_rows($results) < 1)
die(); die();
$buildIds = Array(); $buildIds = Array();
$modeIds = Array(); $modeIds = Array();
$stamps = Array();
while($row = mysql_fetch_array($results)) { while($row = mysql_fetch_array($results)) {
$buildIds[] = $row[0]; $mode = $row[0];
$modeIds[] = $row[1];
// Get last build of a specific mode (not older than 5 days from the newest result).
$query = "SELECT awfy_build.id, stamp FROM `awfy_build`
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE awfy_build.mode_id = $mode AND
machine = $machine AND
stamp >= ".($overview["stamp"]-5*24*60*60)." AND
status = 1
ORDER BY stamp DESC
LIMIT 1";
$buildInfo = mysql_query($query) or die(mysql_error());
if (!$buildInfo || mysql_num_rows($buildInfo) != 1)
continue;
$buildRow = mysql_fetch_array($buildInfo);
$buildIds[] = $buildRow[0];
$modeIds[] = $mode;
$stamps[] = $buildRow[1];
} }
$data = Array(); $data = Array();
@ -69,7 +89,10 @@ while($row = mysql_fetch_array($tests)) {
if (!$results || mysql_num_rows($results) != 1) if (!$results || mysql_num_rows($results) != 1)
continue; continue;
$row = mysql_fetch_array($results); $row = mysql_fetch_array($results);
$scores[] = Array("buildid" => $buildIds[$j], "modeid" => $modeIds[$j], "score" => $row[0]); $scores[] = Array("buildid" => $buildIds[$j],
"modeid" => $modeIds[$j],
"score" => $row[0],
"stamp" => $stamps[$j]);
} }
$data[] = Array("suitetest" => $suiteTest, "scores" => $scores); $data[] = Array("suitetest" => $suiteTest, "scores" => $scores);
} }

Просмотреть файл

@ -13,7 +13,8 @@ init_database();
$machine = (int)$_GET["machine"]; $machine = (int)$_GET["machine"];
$overview = Array(); $overview = Array();
$query = "SELECT id, stamp FROM `awfy_run` // Overall date.
$query = "SELECT stamp FROM `awfy_run`
WHERE machine = $machine AND WHERE machine = $machine AND
status = 1 status = 1
ORDER BY stamp DESC ORDER BY stamp DESC
@ -22,20 +23,40 @@ $results = mysql_query($query);
if (!$results || mysql_num_rows($results) != 1) if (!$results || mysql_num_rows($results) != 1)
die(); die();
$row = mysql_fetch_array($results); $row = mysql_fetch_array($results);
$runId = $row[0];
$overview["machine"] = $machine; $overview["machine"] = $machine;
$overview["stamp"] = $row[1]; $overview["stamp"] = $row[0];
$query = "SELECT id, mode_id FROM `awfy_build` // Get all modes.
WHERE run_id = $runId"; $query = "SELECT mode_id
FROM `awfy_build`
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE machine = $machine
GROUP BY mode_id";
$results = mysql_query($query); $results = mysql_query($query);
if (!$results || mysql_num_rows($results) < 1) if (!$results || mysql_num_rows($results) < 1)
die(); die();
$buildIds = Array(); $buildIds = Array();
$modeIds = Array(); $modeIds = Array();
$stamps = Array();
while($row = mysql_fetch_array($results)) { while($row = mysql_fetch_array($results)) {
$buildIds[] = $row[0]; $mode = $row[0];
$modeIds[] = $row[1];
// Get last build of a specific mode (not older than 5 days from the newest result).
$query = "SELECT awfy_build.id, stamp FROM `awfy_build`
LEFT JOIN awfy_run ON run_id = awfy_run.id
WHERE awfy_build.mode_id = $mode AND
machine = $machine AND
stamp >= ".($overview["stamp"]-5*24*60*60)." AND
status = 1
ORDER BY stamp DESC
LIMIT 1";
$buildInfo = mysql_query($query) or die(mysql_error());
if (!$buildInfo || mysql_num_rows($buildInfo) != 1)
continue;
$buildRow = mysql_fetch_array($buildInfo);
$buildIds[] = $buildRow[0];
$modeIds[] = $mode;
$stamps[] = $buildRow[1];
} }
$query = "SELECT suite_version_id FROM `awfy_score` $query = "SELECT suite_version_id FROM `awfy_score`
@ -71,7 +92,10 @@ for ($i=0; $i < count($suiteIds); $i++) {
if (!$results || mysql_num_rows($results) != 1) if (!$results || mysql_num_rows($results) != 1)
continue; continue;
$row = mysql_fetch_array($results); $row = mysql_fetch_array($results);
$scores[] = Array("buildid" => $buildIds[$j], "modeid" => $modeIds[$j], "score" => $row[0]); $scores[] = Array("buildid" => $buildIds[$j],
"modeid" => $modeIds[$j],
"score" => $row[0],
"stamp" => $stamps[$j]);
} }
$data[] = Array("suiteversionid" => $suiteIds[$i], "scores" => $scores); $data[] = Array("suiteversionid" => $suiteIds[$i], "scores" => $scores);
} }