diff --git a/scripts/overview.php b/scripts/overview.php index e32eb79..bde967e 100644 --- a/scripts/overview.php +++ b/scripts/overview.php @@ -169,12 +169,12 @@ function get_chart_data($db, $force_regen = false) { $result3 = $statement3->execute(); $hourcount = $result3->fetchArray(SQLITE3_ASSOC); - $statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\',\'localtime\')'); + $statement5 = $db->prepare('SELECT COUNT(DISTINCT(Sci_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'); + $statement6 = $db->prepare('SELECT COUNT(DISTINCT(Sci_Name)) FROM detections'); ensure_db_ok($statement6); $result6 = $statement6->execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); @@ -213,12 +213,12 @@ if(isset($_GET['ajax_left_chart']) && $_GET['ajax_left_chart'] == "true") { Species Detected Today -
+
Total Number of Species -
+
@@ -242,8 +242,8 @@ if(isset($_GET['ajax_center_chart']) && $_GET['ajax_center_chart'] == "true") {
-
-
+
+
@@ -317,11 +317,11 @@ if (get_included_files()[0] === __FILE__) { $statement = $db->prepare(" SELECT d_today.Com_Name, d_today.Sci_Name, d_today.Date, d_today.Time, d_today.Confidence, d_today.File_Name, MAX(d_today.Confidence) as MaxConfidence, - (SELECT MAX(Date) FROM detections d_prev WHERE d_prev.Com_Name = d_today.Com_Name AND d_prev.Date < DATE('now', 'localtime')) as LastSeenDate, - (SELECT COUNT(*) FROM detections d_occ WHERE d_occ.Com_Name = d_today.Com_Name AND d_occ.Date = DATE('now', 'localtime')) as OccurrenceCount + (SELECT MAX(Date) FROM detections d_prev WHERE d_prev.Sci_Name = d_today.Sci_Name AND d_prev.Date < DATE('now', 'localtime')) as LastSeenDate, + (SELECT COUNT(*) FROM detections d_occ WHERE d_occ.Sci_Name = d_today.Sci_Name AND d_occ.Date = DATE('now', 'localtime')) as OccurrenceCount FROM detections d_today WHERE d_today.Date = DATE('now', 'localtime') -GROUP BY d_today.Com_Name +GROUP BY d_today.Sci_Name "); ensure_db_ok($statement); $result = $statement->execute(); diff --git a/scripts/todays_detections.php b/scripts/todays_detections.php index ba6adc0..de66ba5 100644 --- a/scripts/todays_detections.php +++ b/scripts/todays_detections.php @@ -46,12 +46,12 @@ ensure_db_ok($statement4); $result4 = $statement4->execute(); $mostrecent = $result4->fetchArray(SQLITE3_ASSOC); -$statement5 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections WHERE Date == Date(\'now\', \'localtime\')'); +$statement5 = $db->prepare('SELECT COUNT(DISTINCT(Sci_Name)) FROM detections WHERE Date == Date(\'now\', \'localtime\')'); ensure_db_ok($statement5); $result5 = $statement5->execute(); $todayspeciestally = $result5->fetchArray(SQLITE3_ASSOC); -$statement6 = $db->prepare('SELECT COUNT(DISTINCT(Com_Name)) FROM detections'); +$statement6 = $db->prepare('SELECT COUNT(DISTINCT(Sci_Name)) FROM detections'); ensure_db_ok($statement6); $result6 = $statement6->execute(); $totalspeciestally = $result6->fetchArray(SQLITE3_ASSOC); @@ -315,10 +315,10 @@ if(isset($_GET['today_stats'])) {
- +
- +
@@ -419,8 +419,8 @@ if (get_included_files()[0] === __FILE__) { - - + +