aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-10-11 20:09:08 +0000
committerrvelices <rv-github@modusoptimus.com>2011-10-11 20:09:08 +0000
commit0320e1f8740457f9ae7cebc1f8151fffef4c4f2e (patch)
tree729c11924c253ef8ae044d5195a7f7c5b72d4e66 /include
parentb4558f32f1662d959eb42a52dedabbe5cb22bfdc (diff)
avoid division by 0 warning when there are no rates in the database
git-svn-id: http://piwigo.org/svn/trunk@12412 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-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 )