From 5a7463e3f9ab243932cd059531ce17c6a219c845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Pleva=C4=8D?= Date: Mon, 9 Oct 2023 15:09:49 +0200 Subject: [PATCH] Get last observation as success observation --- station/config.py | 2 +- web/CONTROLLERS/targets.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/station/config.py b/station/config.py index 29d7882..4dae005 100644 --- a/station/config.py +++ b/station/config.py @@ -1,4 +1,4 @@ masterUrl = "http://10.0.0.8" -apiKey = "783439f5-be14-4877-a396-6d8bc4783c3c" +apiKey = "a22c1e54-d35c-4058-993d-9f34c0fba428" pullInterval = 120 # in sec planInterval = 1200 # in sec \ No newline at end of file diff --git a/web/CONTROLLERS/targets.php b/web/CONTROLLERS/targets.php index 68edaa4..f6efe3b 100644 --- a/web/CONTROLLERS/targets.php +++ b/web/CONTROLLERS/targets.php @@ -12,14 +12,18 @@ $targets = (new \wsos\database\core\table(\DAL\target::class))->getAll(); + // create planed template observations + $ob = new \DAL\observation(); + foreach ($targets->values as $target) { - $last = (new \wsos\database\core\table(\DAL\observation::class))->query("transmitter.target.id = ?", [$target->id->get()], "DESC end", 1); + $last = (new \wsos\database\core\table(\DAL\observation::class))->query("transmitter.target.id == ? && status == ?", [$target->id->get(), $ob->status->getVal("success")], "DESC end", 1); $last = $last->len() > 0 ? "ago " . $last->values[0]->end->strDelta() : "never"; - $observations = (new \wsos\database\core\table(\DAL\observation::class))->count("transmitter.target.id = ?", [$target->id->get()]); + $observations = (new \wsos\database\core\table(\DAL\observation::class))->count("transmitter.target.id == ?", [$target->id->get()]); $context["targets"]->append([ + "id" => $target->id->get(), "name" => $target->name->get(), "orbit" => $target->orbit->get(), "type" => $target->type->get()->name->get(),