Skip to content

A live bird collage card for your Home Assistant dashboard.

Update weekly_report.php

lloydbayley743074b9df36
diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php
index b28ef2ef..e625d3a7 100644
--- a/scripts/weekly_report.php
+++ b/scripts/weekly_report.php
@@ -210,7 +210,11 @@ while($detection=$result1->fetchArray(SQLITE3_ASSOC))
$totalcount = $result2->fetchArray(SQLITE3_ASSOC);
$priorweekcount = $totalcount['COUNT(*)'];
- $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
+ if ($priorweekcount > 0) {
+ $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
+ } else {
+ $percentagediff = 0;
+ }
if($percentagediff > 0) {
$percentagediff = "<span style='color:green;font-size:small'>+".$percentagediff."%</span>";