From 83a52ecbe3bdf14cb9ab66632afae4d45794696c Mon Sep 17 00:00:00 2001 From: fly Date: Sun, 18 Apr 2021 02:08:58 +0200 Subject: [PATCH] Updated api, more flexible get-job and removed get-done Signed-off-by: fly --- managment/www/api.php | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/managment/www/api.php b/managment/www/api.php index 63c5008..f8a8b6c 100644 --- a/managment/www/api.php +++ b/managment/www/api.php @@ -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'] != "")