From 2693adbca8ea0c617a08f6e47f508758e970ec2e Mon Sep 17 00:00:00 2001 From: ehpersonal38 <103586016+ehpersonal38@users.noreply.github.com> Date: Mon, 28 Nov 2022 13:37:59 -0500 Subject: [PATCH] issue #666 --- scripts/weekly_report.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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."%";