Updated api, more flexible get-job and removed get-done

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-04-18 02:08:58 +02:00
parent 6d1793b805
commit 83a52ecbe3

View file

@ -129,7 +129,7 @@ if ($action == "set")
quit();
}
}
else if ($action == "get-job" && isset($_POST["type"]) && $_POST["type"] != "")
else if ($action == "get-job" && isset($_POST["status"]) && $_POST["status"] != "" && isset($_POST["new-status"]) && $_POST["new-status"] != "")
{
get_lock($con);
$sql = "SELECT id FROM tile WHERE status_id = (SELECT id FROM status WHERE name = ?) ORDER BY parent_id LIMIT 1";
@ -149,19 +149,10 @@ else if ($action == "get-job" && isset($_POST["type"]) && $_POST["type"] != "")
}
else
{
set_status($con, $ret->job, "started", "tile");
set_status($con, $ret->job, $_POST["new-status"], "tile");
}
rel_lock($con);
}
else if ($action == "get-done")
{
$sql = "SELECT name FROM secondLevel WHERE status_id = (SELECT id FROM status WHERE name = 'done') LIMIT 1";
$ret->job = $con->query($sql)->fetch_array()[0];
if ($ret->job == Null)
{
$ret->job = "None";
}
}
else if ($action == "status")
{
if (isset($_POST['tile']) && $_POST['tile'] != "")