From 75b6558063852aa5906fe06298c43a2b2b6f4c60 Mon Sep 17 00:00:00 2001 From: Lukas Plevac Date: Fri, 29 Dec 2023 08:40:49 +0000 Subject: [PATCH] Added auto fail observation when timeout --- web/API/crons.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/web/API/crons.php b/web/API/crons.php index a2b1dfa..d66d61e 100644 --- a/web/API/crons.php +++ b/web/API/crons.php @@ -2,7 +2,8 @@ namespace API\cron; function all($params) { - + tle($params); + autoFail($params); } function tle($params) { @@ -36,4 +37,17 @@ } return $updated; + } + + function autoFail($params) { + $observations = new \wsos\database\core\table(\DAL\observation::class); + $ob = new \DAL\observation(); + + $faild = $observations->query("status==? && startstatus->getVal("assigned"), time() - 300]); + + foreach ($fob in $faild->values) { + $fob->status->set("fail"); + $fob->commit(); + } + } \ No newline at end of file