From a62591dede5f968696c4d0065dbc6bd589c3e30f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:07:34 +0200 Subject: [PATCH 01/58] Move chart to center --- scripts/overview.php | 51 +++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 017787fab..57e21ef5b 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -151,7 +151,7 @@ die(); } -if(isset($_GET['ajax_left_chart']) && $_GET['ajax_left_chart'] == "true") { +if(isset($_GET['ajax_center_chart']) && $_GET['ajax_center_chart'] == "true") { $statement = $db->prepare('SELECT COUNT(*) FROM detections'); ensure_db_ok($statement); @@ -174,31 +174,22 @@ $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); ?> - - - - +
Total
+ + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - -
TotalTodayLast HourUnique Species TodayUnique Species Total
Today
Last Hour
Species Detected Today
Total Number of Species
+ +
-
@@ -293,7 +283,6 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {

-
+ +

Number of Detections

From 79fe8c7a113c32aef6de7df2c878e1e54b7a86f8 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:40:09 +0200 Subject: [PATCH 05/58] Removed title : cleaner look --- scripts/overview.php | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/overview.php b/scripts/overview.php index 9c1272e22..913894649 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -250,7 +250,6 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) { showDialog(); } -

Number of Detections

From 75e7e90e5ab9076e9a271816c189d3b20c51ad8d Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:42:11 +0200 Subject: [PATCH 06/58] Shorter titles for stats --- scripts/overview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 913894649..2e95e234d 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -178,8 +178,8 @@ Total Today Last Hour - Unique Species Today - Unique Species Total + Species Today + Species Total From 64b73052321188ff3470b9fdf9e1eac2d9f78480 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 17 Sep 2024 17:44:56 +0200 Subject: [PATCH 07/58] Shorter title, unique is implicit --- scripts/todays_detections.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index e0f609df7..89caf5433 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -303,8 +303,8 @@ function relativeTime($ts) Total Today Last Hour - Unique Species Total - Unique Species Today + Species Total + Species Today @@ -410,8 +410,8 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) { Total Today Last Hour - Unique Species Total - Unique Species Today + Species Total + Species Today From ec680735dfd7682a92fe82e9dd9dc80066a8fa73 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 17 Sep 2024 21:26:49 +0200 Subject: [PATCH 08/58] Invert Species Total and Today --- scripts/overview.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/overview.php b/scripts/overview.php index 2e95e234d..93d9dc61c 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -178,15 +178,15 @@ Total Today Last Hour - Species Today Species Total + Species Today
-
+
From 30876cda6f5027a844565afebadfa20611491bde Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:48:49 +0200 Subject: [PATCH 09/58] Re-add left chart --- scripts/overview.php | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/scripts/overview.php b/scripts/overview.php index 93d9dc61c..35c10f3a8 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -151,6 +151,58 @@ die(); } +if(isset($_GET['ajax_left_chart']) && $_GET['ajax_left_chart'] == "true") { + +$statement = $db->prepare('SELECT COUNT(*) FROM detections'); +ensure_db_ok($statement); +$result = $statement->execute(); +$totalcount = $result->fetchArray(SQLITE3_ASSOC); + +$statement3 = $db->prepare('SELECT COUNT(*) FROM detections WHERE Date == Date(\'now\', \'localtime\') AND TIME >= TIME(\'now\', \'localtime\', \'-1 hour\')'); +ensure_db_ok($statement3); +$result3 = $statement3->execute(); +$hourcount = $result3->fetchArray(SQLITE3_ASSOC); + +$statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\',\'localtime\')'); +ensure_db_ok($statement5); +$result5 = $statement5->execute(); +$speciestally = $result5->fetchArray(SQLITE3_ASSOC); + +$statement6 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections'); +ensure_db_ok($statement6); +$result6 = $statement6->execute(); +$totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); + +?> + + + + + + + + + + + + + + + + + + + + + + + + +
Total
Today
Last Hour
Species Detected Today
Total Number of Species
+prepare('SELECT COUNT(*) FROM detections'); @@ -251,6 +303,7 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) { }
+
@@ -296,6 +349,7 @@ function loadDetectionIfNewExists(previous_detection_identifier=undefined) { // only going to load left chart & 5 most recents if there's a new detection loadCenterChart(); + loadLeftChart(); loadFiveMostRecentDetections(); refreshTopTen(); } @@ -303,6 +357,16 @@ function loadDetectionIfNewExists(previous_detection_identifier=undefined) { xhttp.open("GET", "overview.php?ajax_detections=true&previous_detection_identifier="+previous_detection_identifier, true); xhttp.send(); } +function loadLeftChart() { + const xhttp = new XMLHttpRequest(); + xhttp.onload = function() { + if(this.responseText.length > 0 && !this.responseText.includes("Database is busy")) { + document.getElementsByClassName("left-column")[0].innerHTML = this.responseText; + } + } + xhttp.open("GET", "overview.php?ajax_left_chart=true", true); + xhttp.send(); +} function loadCenterChart() { const xhttp = new XMLHttpRequest(); xhttp.onload = function() { From 354678d023021b816885f2895ad8faae6989b1c7 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 28 Sep 2024 20:50:03 +0200 Subject: [PATCH 10/58] Re-add left chart bis --- scripts/overview.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/overview.php b/scripts/overview.php index 35c10f3a8..934f2a888 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -301,7 +301,7 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) { last_photo_link = text; showDialog(); } - +
@@ -336,6 +336,7 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {

+
+

Choose a species to load images from Flickr.