Merge pull request #766 from bogey3/patch-1
Resolved division by 0 error that occurs in a weekly report for the first week of use where no previous data exists.
This commit is contained in:
@@ -100,6 +100,7 @@ if(isset($_GET['ascii'])) {
|
|||||||
$priorweekcount = $totalcount['COUNT(*)'];
|
$priorweekcount = $totalcount['COUNT(*)'];
|
||||||
|
|
||||||
// really percent changed
|
// really percent changed
|
||||||
|
if($priorweekcount > 0){
|
||||||
$percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
|
$percentagediff = round( (($scount - $priorweekcount) / $priorweekcount) * 100 );
|
||||||
|
|
||||||
if($percentagediff > 0) {
|
if($percentagediff > 0) {
|
||||||
@@ -109,6 +110,9 @@ if(isset($_GET['ascii'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
echo $com_name." - ".$scount." (".$percentagediff.")<br>";
|
echo $com_name." - ".$scount." (".$percentagediff.")<br>";
|
||||||
|
} else {
|
||||||
|
echo $com_name." - ".$scount ."<br>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user