This commit is contained in:
Hannes Verschore 2015-07-27 14:36:58 -07:00
Родитель 1446dfd9b7
Коммит 34e62646c5
3 изменённых файлов: 86 добавлений и 12 удалений

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

@ -11,6 +11,8 @@ $subtest = GET_bool("subtest");
$id = GET_int("id");
if ($subtest) {
$score_id = get("score", $id, "score_id");
$prev_breakdown_id = imm_prev_suite_test($id);
$prev_score_id = get("breakdown", $prev_breakdown_id, "score_id");
$prev_build_id = get("score", $prev_score_id, "build_id");
@ -21,6 +23,8 @@ if ($subtest) {
WHERE breakdown_id = ".$id." AND
prev_build_id = ".$prev_build_id);
} else {
$score_id = $id;
$prev_score_id = imm_prev_($id);
$prev_build_id = get("score", $prev_score_id, "build_id");
$query = mysql_query("SELECT awfy_regression.id, noise, status
@ -30,16 +34,18 @@ if ($subtest) {
WHERE score_id = ".$id." AND
prev_build_id = ".$prev_build_id);
}
$data = Array();
$data = Array("regression" => Array());
if (mysql_num_rows($query) >= 1) {
$result = mysql_fetch_object($query);
$data["id"] = $result->id;
$data["regression"]["id"] = $result->id;
if ($result->noise)
$data["status"] = "noise";
$data["regression"]["status"] = "noise";
else
$data["status"] = $result->status;
$data["regression"]["status"] = $result->status;
} else {
$data["status"] = "no";
$data["regression"]["status"] = "no";
}
$data["info"] = get("score", $score_id, "extra_info");
echo json_encode($data);

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

@ -619,22 +619,24 @@ Display.prototype.createToolTip = function (item, extended) {
while (document.getElementById("update_"+id))
id = Math.random();
text += so + 'regression?: ' + sc + "<span id='update_" + id + "'><img src='loading.gif' height='12px'/></span>" + '<br>';
text += so + 'regression?: ' + sc + "<span id='update_regression_" + id + "'><img src='loading.gif' height='12px'/></span>" + '<br>';
text += so + 'extra info: ' + sc + "<span id='update_info_" + id + "'><img src='loading.gif' height='12px'/></span>" + '<br>';
var subtest = AWFY.isSubtest();
$.get("data-regression.php", {
$.get("data-info.php", {
subtest: subtest,
id: point[4]
}, function(data) {
var html = data.status;
if (data.id) {
html += " <a href='regressions/#regression/"+data.id+"'>(view)</a>"
var html = data.regression.status;
if (data.regression.id) {
html += " <a href='regressions/#regression/"+data.regression.id+"'>(view)</a>"
} else {
if (subtest)
html += " <a href='regressions/#add/subtest/"+point[4]+"'>(report regression)</a>"
else
html += " <a href='regressions/#add/"+point[4]+"'>(report regression)</a>"
}
document.getElementById("update_"+id).innerHTML = html;
document.getElementById("update_regression_"+id).innerHTML = html;
document.getElementById("update_info_"+id).innerHTML = data.info;
}, "json");
}
}

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

@ -0,0 +1,66 @@
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require_once("../internals.php");
require_once("data-func.php");
init_database();
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$request->machine = (int) $request->machine;
$request->mode = (int) $request->mode;
if (isset($request->rev)) {
$request->rev = preg_replace("/[^A-Za-z0-9]/", "", $request->rev);
$query = mysql_query("SELECT awfy_build.id
FROM `awfy_build`
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE machine = ".$request->machine." AND
mode_id = ".$request->mode." AND
rev = ".$request->rev."
LIMIT 1
") or die(mysql_error());
$data = mysql_fetch_assoc($query);
} else {
$query = mysql_query("SELECT awfy_build.id
FROM `awfy_build`
LEFT JOIN awfy_run ON awfy_run.id = run_id
WHERE machine = ".$request->machine." AND
mode_id = ".$request->mode." AND
status = 1
ORDER BY stamp DESC
LIMIT 1") or die(mysql_error());
$data = mysql_fetch_assoc($query);
}
$all_scores = Array();
$qScores = mysql_query("SELECT *
FROM awfy_score
WHERE build_id = ".$data["id"]) or die(mysql_error());
while ($scores = mysql_fetch_assoc($qScores)) {
$score = array(
"suite_version" => $scores["suite_version_id"],
"score" => $scores["score"]
);
$all_scores[] = $score;
}
$qScores = mysql_query("SELECT *
FROM awfy_breakdown
WHERE build_id = ".$data["id"]) or die(mysql_error());
while ($scores = mysql_fetch_assoc($qScores)) {
$suite_version_id = get("suite_test", $scores["suite_test_id"], "suite_version_id");
$score = array(
"suite_version" => $suite_version_id,
"suite_test" => get("suite_test", $scores["suite_test_id"], "name"),
"score" => $scores["score"]
);
$all_scores[] = $score;
}
die(json_encode($all_scores));