avoid division by 0 warning when there are no rates in the database
git-svn-id: http://piwigo.org/svn/branches/2.3@12413 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
6acbf6dfc3
commit
4d8cd5a9e3
1 changed files with 5 additions and 2 deletions
|
@ -150,8 +150,11 @@ SELECT element_id,
|
|||
$by_item[$row['element_id']] = $row;
|
||||
}
|
||||
|
||||
$all_rates_avg /= $all_rates_count;
|
||||
$item_ratecount_avg = $all_rates_count / count($by_item);
|
||||
if ($all_rates_count>0)
|
||||
{
|
||||
$all_rates_avg /= $all_rates_count;
|
||||
$item_ratecount_avg = $all_rates_count / count($by_item);
|
||||
}
|
||||
|
||||
$updates = array();
|
||||
foreach ($by_item as $id => $rate_summary )
|
||||
|
|
Loading…
Reference in a new issue