aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-10-11 20:14:11 +0000
committerrvelices <rv-github@modusoptimus.com>2011-10-11 20:14:11 +0000
commit4d8cd5a9e3727aca880e3f27e3b537fe4f76bd10 (patch)
tree2ec07e8e450c461b3ac5c2615ccc3268905b4db3 /include
parent6acbf6dfc327ace144af72f8b0db8d5b595bba7a (diff)
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
Diffstat (limited to 'include')
-rw-r--r--include/functions_rate.inc.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/functions_rate.inc.php b/include/functions_rate.inc.php
index 4cf6cc9ca..fdb21e242 100644
--- a/include/functions_rate.inc.php
+++ b/include/functions_rate.inc.php
@@ -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 )