Update the updater to use consecutive sort_ids

This commit is contained in:
Hannes Verschore 2015-10-27 14:53:06 +01:00
Родитель 1fbf350b4f
Коммит 84db76205a
1 изменённых файлов: 7 добавлений и 22 удалений

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

@ -7,19 +7,6 @@ require_once("internals.php");
init_database();
if (isset($_GET['requests'])) {
$MACHINE = GET_int('MACHINE');
$query = mysql_query("SELECT * FROM awfy_request
WHERE finished = 0
AND machine = $MACHINE");
$data = Array();
while ($output = mysql_fetch_assoc($query)) {
$data[] = $output;
}
echo json_encode($data);
die();
}
// Start a full benchmark run. Request a token/number used to report/group
// benchmark scores.
if (isset($_GET['run']) && $_GET['run'] == 'yes') {
@ -27,10 +14,15 @@ if (isset($_GET['run']) && $_GET['run'] == 'yes') {
// order, but only set this afterwards.
$MACHINE = GET_int('MACHINE');
$stamp = GET_int('stamp');
$stamp = ($stamp != 0) ? $stamp : "UNIX_TIMESTAMP()";
$query = mysql_query("SELECT max(sort_order) as maximum
FROM awfy_run
WHERE machine = '".$MACHINE."'") or die(mysql_error());
$run = mysql_fetch_object($query);
mysql_query("INSERT INTO awfy_run (machine, sort_order)
VALUES
($MACHINE, $stamp)")
($MACHINE, {$run->maximum})")
or die("ERROR: " . mysql_error());
print("id=" . mysql_insert_id());
die();
@ -52,13 +44,6 @@ if (isset($_GET['run']) && $_GET['run'] == 'finish') {
WHERE id = $runid")
or die("ERROR: " . mysql_error());
mysql_query("UPDATE awfy_request as request
JOIN awfy_build as build ON request.cset = build.cset
JOIN awfy_run as run ON run.id = build.run_id
AND run.machine = request.machine
SET finished = 1
WHERE run.id = $runid")
or die("ERROR: " . mysql_error());
die();
}