Skip to content

Commit

Permalink
Merge pull request #10372 from wdammak/patch-21
Browse files Browse the repository at this point in the history
Update stats.class.php
  • Loading branch information
eldy committed Jan 19, 2019
2 parents 302a838 + 9f60c20 commit 22b0173
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions htdocs/core/class/stats.class.php
Expand Up @@ -384,16 +384,16 @@ function _getAllByYear($sql)
$row = $this->db->fetch_object($resql);
$result[$i]['year'] = $row->year;
$result[$i]['nb'] = $row->nb;
if($i>0 && $row->nb) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
if($i>0 && $row->nb>0) $result[$i-1]['nb_diff'] = ($result[$i-1]['nb'] - $row->nb) / $row->nb * 100;
$result[$i]['total'] = $row->total;
if($i>0 && $row->total) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
if($i>0 && $row->total>0) $result[$i-1]['total_diff'] = ($result[$i-1]['total'] - $row->total) / $row->total * 100;
$result[$i]['avg'] = $row->avg;
if($i>0 && $row->avg) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
if($i>0 && $row->avg>0) $result[$i-1]['avg_diff'] = ($result[$i-1]['avg'] - $row->avg) / $row->avg * 100;
// For some $sql only
if (isset($row->weighted))
{
$result[$i]['weighted'] = $row->weighted;
if($i>0 && $row->weighted) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
if($i>0 && $row->weighted>0) $result[$i-1]['avg_weighted'] = ($result[$i-1]['weighted'] - $row->weighted) / $row->weighted * 100;
}
$i++;
}
Expand Down

0 comments on commit 22b0173

Please sign in to comment.