From f222329b7c8402e3ac82e70826d51c17020be842 Mon Sep 17 00:00:00 2001 From: frederik Date: Sun, 14 Sep 2025 09:57:30 +0200 Subject: [PATCH] cleanup: we usually do not need $todaycount so move it to where is needed --- scripts/overview.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 8aa768f..534809d 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -15,11 +15,6 @@ $chart = "Combo-$myDate.png"; $db = new SQLite3('./scripts/birds.db', SQLITE3_OPEN_READONLY); $db->busyTimeout(1000); -$statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\', \'localtime\')'); -ensure_db_ok($statement2); -$result2 = $statement2->execute(); -$todaycount = $result2->fetchArray(SQLITE3_ASSOC); - if(isset($_GET['custom_image'])){ if(isset($config["CUSTOM_IMAGE"])) { ?> @@ -143,6 +138,10 @@ if(isset($_GET['ajax_detections']) && $_GET['ajax_detections'] == "true" && isse } } if($iterations == 0) { + $statement2 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == DATE(\'now\', \'localtime\')'); + ensure_db_ok($statement2); + $result2 = $statement2->execute(); + $todaycount = $result2->fetchArray(SQLITE3_ASSOC); if($todaycount['COUNT(*)'] > 0) { echo "

Your system is currently processing a backlog of audio. This can take several hours before normal functionality of your BirdNET-Pi resumes.

"; } else {