From e2062362b832823ab0e41f12559aa636a612e8e7 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 12 Jan 2023 18:04:15 -0500 Subject: [PATCH] Update todays_detections.php --- scripts/todays_detections.php | 64 ++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index db87185..558bba5 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -280,6 +280,34 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { die(); } +if(isset($_GET['today_stats'])) { + ?> + + + + + + + + + + + + + + + + + + + + + +
TotalTodayLast HourUnique Species TotalUnique Species Today
+ @@ -322,28 +350,7 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" ) { }

Number of Detections

- - - - - - - - - - - - - - - - - - - - - -
TotalTodayLast HourUnique Species TotalUnique Species Today
+

Today's Detections

@@ -440,14 +447,25 @@ function loadDetections(detections_limit, element=undefined) { } xhttp.send(); } +function refreshTodayStats() { + const xhttp = new XMLHttpRequest(); + xhttp.onload = function() { + if(this.responseText.length > 0 && !this.responseText.includes("Database is busy")) { + document.getElementById("todaystats").innerHTML = this.responseText; + } + } + xhttp.open("GET", "todays_detections.php?today_stats=true", true); + xhttp.send(); +} window.addEventListener("load", function(){ document.getElementById("myTopnav").remove(); loadDetections(undefined); + refreshTodayStats(); // refresh the kiosk detection list every minute setTimeout(function() { loadDetections(undefined); - document.getElementById("searchterm").blur(); + refreshTodayStats(); }, 60000); loadDetections(40);