Skip to content

A live bird collage card for your Home Assistant dashboard.

Update weekly_report.php

ehpersonal38576740996b37
diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php
index 5b1b449c..a5ada8b3 100644
--- a/scripts/weekly_report.php
+++ b/scripts/weekly_report.php
@@ -134,8 +134,11 @@ if(isset($_GET['ascii'])) {
echo "No new species were seen this week.";
}
+ $prevweek = date('W', $enddate) - 1;
+ if($prevweek < 1) { $prevweek = 52; }
+
echo "<hr><small>* data from ".date('Y-m-d', $startdate)." — ".date('Y-m-d',$enddate).".</small><br>";
- echo '<small>* percentages are calculated relative to week '.(date('W', $enddate) - 1).'.</small>';
+ echo '<small>* percentages are calculated relative to week '.($prevweek).'.</small>';
die();
}
@@ -256,4 +259,4 @@ while($detection=$result1->fetchArray(SQLITE3_ASSOC))
<br>
<div style="text-align:center">
<hr><small style="font-size:small">* percentages are calculated relative to week <?php echo date('W', $enddate) - 1; ?></small>
-</div>
\ No newline at end of file
+</div>