Skip to content

A live bird collage card for your Home Assistant dashboard.

Add occurences Count to best recordings

Alexandreb451af026060
diff --git a/scripts/stats.php b/scripts/stats.php
index 4f5dfa90..2f396fb0 100644
--- a/scripts/stats.php
+++ b/scripts/stats.php
@@ -92,7 +92,7 @@ if (get_included_files()[0] === __FILE__) {
<table>
<?php
$birds = array();
- $confidence = array();
+ $values = array();
while($results=$result2->fetchArray(SQLITE3_ASSOC))
{
@@ -101,7 +101,9 @@ if (get_included_files()[0] === __FILE__) {
$filename = "/By_Date/".$results['Date']."/".$comname."/".$results['File_Name'];
$birds[] = $results['Com_Name'];
if ($_GET['sort'] == "confidence") {
- $confidence[] = ' (' . round($results['MAX(Confidence)'] * 100) . '%)';
+ $values[] = ' (' . round($results['MAX(Confidence)'] * 100) . '%)';
+ } elseif ($_GET['sort'] == "occurrences") {
+ $values[] = ' (' . $results['COUNT(*)'] . ')';
}
}
@@ -121,7 +123,7 @@ if (get_included_files()[0] === __FILE__) {
if ($index < count($birds)) {
?>
<td>
- <button type="submit" name="species" value="<?php echo $birds[$index];?>"><?php echo $birds[$index].$confidence[$index];?></button>
+ <button type="submit" name="species" value="<?php echo $birds[$index];?>"><?php echo $birds[$index].$values[$index];?></button>
</td>
<?php
} else {