From e1dbefb5f3a1b4987fc6003682c6c3b6d0dfa360 Mon Sep 17 00:00:00 2001
From: Alexandre <44178713+alexbelgium@users.noreply.github.com>
Date: Tue, 26 Nov 2024 09:59:19 +0100
Subject: [PATCH] New layout
---
scripts/overview.php | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/scripts/overview.php b/scripts/overview.php
index faf77e76..0c98bea6 100644
--- a/scripts/overview.php
+++ b/scripts/overview.php
@@ -314,9 +314,10 @@ function setModalText(iter, title, text, authorlink, photolink, licenseurl) {
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,
- COUNT(d_today.Com_Name) as OccurrenceCount,
- (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 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') AND d_occ.Time >= d_today.Time) as OccurrenceCount
FROM detections d_today
WHERE d_today.Date = DATE('now', 'localtime')
GROUP BY d_today.Com_Name
@@ -402,21 +403,21 @@ function display_species($species_list, $title, $show_last_seen=false) {
$days_ago = $todaytable['DaysAgo'];
if ($days_ago > 30) {
$months_ago = floor($days_ago / 30);
- $last_seen_text = "{$todaytable['Time']}
Last seen: {$months_ago}mo ago";
+ $last_seen_text = "
Last: {$months_ago}mo ago";
} else {
- $last_seen_text = "{$todaytable['Time']}
Last seen: {$days_ago}d ago";
+ $last_seen_text = "
Last: {$days_ago}d ago";
}
- } else {
- $last_seen_text = $todaytable['Time'];
+
}
- // Get the occurrence count for this species
- $occurrence_count = $todaytable['OccurrenceCount'];
+ $time_occurrence_text = "
{$todaytable['Time']}";
+ if (isset($todaytable['OccurrenceCount']) && $todaytable['OccurrenceCount'] > 1) {
+ $time_occurrence_text .= " ({$todaytable['OccurrenceCount']}x)";
+ }
?>