Added auto fail observation when timeout

This commit is contained in:
Lukáš Plevač 2023-12-29 08:40:49 +00:00
parent aaf501aff1
commit 75b6558063

View File

@ -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==? && start<?", [$ob->status->getVal("assigned"), time() - 300]);
foreach ($fob in $faild->values) {
$fob->status->set("fail");
$fob->commit();
}
}