Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/bundles/dashboard/models/graphs.php b/bundles/dashboard/models/graphs.php
- index 255e599..182c39d 100755
- --- a/bundles/dashboard/models/graphs.php
- +++ b/bundles/dashboard/models/graphs.php
- @@ -199,7 +199,8 @@ class graphs {
- $input['numberReads'] = $this->groupBySum($input['numberReads'], 'createdAt', 'numberReads');
- foreach($input['numberPublications'] as $key => $x) {
- - $result[$key] = (( $input['numberPublications'][$key] / $input['numberReads'][$key] ) * 100);
- + $numberReads = ($input['numberReads'][$key] == 0) ? 100 : $input['numberReads'][$key];
- + $result[$key] = (( $input['numberPublications'][$key] / $numberReads ) * 100);
- }
- return $result;
- /////
- When a research isn't readed, you have a division by 0 -> error
- now if a research isn't readed, i set the numberReads to 100 so the equation look like :
- $result = NumberPublications * 100 / 100
- i don't know if the calcul is right but i don't have the exception anymore :)
Add Comment
Please, Sign In to add comment