diff --git a/homepage/views.php b/homepage/views.php index 8da5c67..f056bc4 100644 --- a/homepage/views.php +++ b/homepage/views.php @@ -512,7 +512,7 @@ function update_species_list($filename, $species, $add) { if($_GET['view'] == "Kiosk"){$kiosk = true;include('todays_detections.php');} if($_GET['view'] == "Species Stats"){include('stats.php');} if($_GET['view'] == "Weekly Report" || $_GET['view'] == "Report" || $_GET['view'] == "Reports"){include('scripts/reports.php');} - if($_GET['view'] == "Insights"){include('insights.php');} + if($_GET['view'] == "Insights"){include('scripts/insights.php');} if($_GET['view'] == "Analytics"){include('scripts/analytics.php');} if($_GET['view'] == "Species"){include('scripts/species.php');} if($_GET['view'] == "Daily Charts"){include('history.php');} diff --git a/scripts/insights.php b/scripts/insights.php index 128a3e7..eb6cff7 100644 --- a/scripts/insights.php +++ b/scripts/insights.php @@ -285,7 +285,7 @@ $wind_impact = $unified_wind; $ideal_res = $db->query("SELECT d.Com_Name, ROUND(AVG(w.Temp), 1) as avg_temp, ROUND(MIN(w.Temp), 1) as min_temp, ROUND(MAX(w.Temp), 1) as max_temp, COUNT(*) as cnt FROM detections d INNER JOIN weather w ON d.Date = w.Date AND CAST(substr(d.Time, 1, 2) AS INTEGER) = w.Hour GROUP BY d.Sci_Name HAVING cnt >= 5 ORDER BY cnt DESC"); while($row = $ideal_res->fetchArray(SQLITE3_ASSOC)) { $species_ideal[] = $row; } - $trend_res = $db->query("SELECT d.Date, COUNT(*) as det_count, ROUND(AVG(w.Temp), 1) as avg_temp FROM detections d LEFT JOIN weather w ON d.Date = w.Date AND CAST(substr(d.Time, 1, 2) AS INTEGER) = w.Hour WHERE d.Date >= '$one_month_ago' GROUP BY d.Date ORDER BY d.Date ASC"); + $trend_res = $db->query("SELECT d.Date, COUNT(*) as det_count, ROUND((SELECT AVG(w2.Temp) FROM weather w2 WHERE w2.Date = d.Date), 1) as avg_temp FROM detections d WHERE d.Date >= '$one_month_ago' GROUP BY d.Date ORDER BY d.Date ASC"); while($row = $trend_res->fetchArray(SQLITE3_ASSOC)) { $temp_vs_detections[] = $row; } $temp_trend_labels = json_encode(array_map(function($r) { return date('M j', strtotime($r['Date'])); }, $temp_vs_detections)); $temp_trend_temps = json_encode(array_map(function($r) { return $r['avg_temp']; }, $temp_vs_detections)); diff --git a/scripts/species.php b/scripts/species.php index 08b8717..fb213f4 100644 --- a/scripts/species.php +++ b/scripts/species.php @@ -184,6 +184,10 @@ .stats-table { width: 100%; font-size: 0.85rem; } .stats-table tr td:first-child { color: var(--text-muted); padding-bottom: 4px; } .stats-table tr td:last-child { text-align: right; font-weight: 600; color: var(--text-primary); padding-bottom: 4px; } +.species-card-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; } +.species-card-links .mrd-link-pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 600; text-decoration: none; color: var(--text-muted); background: var(--bg-input, #f1f5f9); border: 1px solid var(--border); transition: background 0.2s, color 0.2s; } +.species-card-links .mrd-link-pill img { width: 12px; height: 12px; } +.species-card-links .mrd-link-pill:hover { background: var(--accent); color: white; } @@ -304,6 +308,11 @@ Confidence:% First: + +