From d7e9ad10279746ca6ca36ce7bda2f293e7474b8d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 7 Apr 2001 18:26:14 +0000 Subject: - small update to gravity --- includes/user.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'includes/user.inc') diff --git a/includes/user.inc b/includes/user.inc index 18f48ce52..d5bfc8524 100644 --- a/includes/user.inc +++ b/includes/user.inc @@ -116,7 +116,7 @@ function user_gravity($id) { $bonus -= $story->number; } - $r3 = db_query("SELECT score, votes FROM comments WHERE author = '$id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); + $r3 = db_query("SELECT score, votes FROM comments WHERE author = '$id' AND votes > 0 AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number"); while ($comment = db_fetch_object($r3)) { $weight++; $score += $weight * $comment->score; @@ -125,8 +125,7 @@ function user_gravity($id) { $bonus += $weight / 5; - if ($votes > 0) return ($score + $weight) / $votes + $bonus; - else return 0; + return ($votes ? ($score + $weight) / $votes + $bonus : 0); } ?> \ No newline at end of file -- cgit v1.2.3