diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-04-07 18:26:14 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-04-07 18:26:14 +0000 |
commit | d7e9ad10279746ca6ca36ce7bda2f293e7474b8d (patch) | |
tree | 4d4679bf930dbad19200c0abb3bb7aad5edf2a96 /includes/user.inc | |
parent | e46981ddb71a513555ec4970876016578339ebee (diff) | |
download | brdo-d7e9ad10279746ca6ca36ce7bda2f293e7474b8d.tar.gz brdo-d7e9ad10279746ca6ca36ce7bda2f293e7474b8d.tar.bz2 |
- small update to gravity
Diffstat (limited to 'includes/user.inc')
-rw-r--r-- | includes/user.inc | 5 |
1 files changed, 2 insertions, 3 deletions
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 |