diff --git a/scripts/weekly_report.php b/scripts/weekly_report.php
index a5ada8b..ccc2e5c 100644
--- a/scripts/weekly_report.php
+++ b/scripts/weekly_report.php
@@ -55,7 +55,7 @@ if(isset($_GET['ascii'])) {
$result7= $statement7->execute();
$priortotalspeciestally = $result7->fetchArray(SQLITE3_ASSOC)['COUNT(DISTINCT(Com_Name))'];
- $percentagedifftotal = round((1 - $priortotalcount / $totalcount) * 100);
+ $percentagedifftotal = round( (($totalcount - $priortotalcount) / $priortotalcount) * 100 );
if($percentagedifftotal > 0) {
$percentagedifftotal = "+".$percentagedifftotal."%";
@@ -63,7 +63,7 @@ if(isset($_GET['ascii'])) {
$percentagedifftotal = "-".abs($percentagedifftotal)."%";
}
- $percentagedifftotaldistinctspecies = round((1 - $priortotalspeciestally / $totalspeciestally) * 100);
+ $percentagedifftotaldistinctspecies = round( (($totalspeciestally - $priortotalspeciestally) / $priortotalspeciestally) * 100 );
if($percentagedifftotaldistinctspecies > 0) {
$percentagedifftotaldistinctspecies = "+".$percentagedifftotaldistinctspecies."%";
} else {
@@ -99,7 +99,8 @@ if(isset($_GET['ascii'])) {
$totalcount = $result2->fetchArray(SQLITE3_ASSOC);
$priorweekcount = $totalcount['COUNT(*)'];
- $percentagediff = round((1 - $priorweekcount / $scount) * 100);
+ // really percent changed
+ $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
if($percentagediff > 0) {
$percentagediff = "+".$percentagediff."%";
@@ -205,7 +206,7 @@ while($detection=$result1->fetchArray(SQLITE3_ASSOC))
$totalcount = $result2->fetchArray(SQLITE3_ASSOC);
$priorweekcount = $totalcount['COUNT(*)'];
- $percentagediff = round((1 - $priorweekcount / $scount) * 100);
+ $percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
if($percentagediff > 0) {
$percentagediff = "+".$percentagediff."%";