From cc1a656069c8a9d6f3b65fd3ba921a2c116b4fe5 Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Thu, 14 Apr 2022 15:33:41 -0400 Subject: [PATCH] Update todays_detections.php Two main changes: 1) A "Show 40 more detections" feature has been added, which only shows 40 detections at a time, significantly improving performance when you have a lot of detections in one day. 2) Because of this performance increase, a spectrogram image with accompanying audio can be displayed, like the one on the "Overview page." This makes it a little more intuitive to listen to the recordings. --- scripts/todays_detections.php | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index eb18512..46c576f 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -3,13 +3,21 @@ ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); +if(isset($_POST['display_limit'])) { + if(is_numeric($_POST['display_limit'])) { + $display_limit = $_POST['display_limit'] + 40; + } +} else { + $display_limit = 40; +} + $db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_CREATE | SQLITE3_OPEN_READWRITE); if($db == False){ echo "Database is busy"; header("refresh: 0;"); } -$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC'); +$statement0 = $db->prepare('SELECT Time, Com_Name, Sci_Name, Confidence, File_Name FROM detections WHERE Date == Date(\'now\', \'localtime\') ORDER BY Time DESC LIMIT '.$display_limit.''); if($statement0 == False){ echo "Database is busy"; header("refresh: 0;"); @@ -63,8 +71,6 @@ if($statement6 == False){ } $result6 = $statement6->execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); - - ?> @@ -101,23 +107,40 @@ $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); +
Confidence: - |
+
+