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);