summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/rating.module15
1 files changed, 11 insertions, 4 deletions
diff --git a/modules/rating.module b/modules/rating.module
index 546c53a68..c38f2a2d4 100644
--- a/modules/rating.module
+++ b/modules/rating.module
@@ -6,6 +6,8 @@ $module = array("cron" => "rating_cron",
"block" => "rating_block");
function rating_cron() {
+ global $status;
+
$period = 5184000; // 60 days
$number = 30; // 30 comments
$offset = 5; // 5 comments
@@ -14,13 +16,18 @@ function rating_cron() {
while ($rating = db_fetch_object($r1)) {
unset($bonus); unset($votes); unset($score); unset($value); unset($weight);
- $r2 = db_query("SELECT COUNT(nid) AS number FROM nodes WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = 2");
+ $r2 = db_query("SELECT COUNT(nid) AS number FROM nodes WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[posted]'");
if ($story = db_fetch_object($r2)) {
- $bonus = $story->number;
+ $bonus += $story->number / 2;
+ }
+
+ $r3 = db_query("SELECT COUNT(nid) AS number FROM nodes WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) AND status = '$status[dumped]'");
+ if ($story = db_fetch_object($r3)) {
+ $bonus -= $story->number / 2;
}
- $r3 = db_query("SELECT score, votes FROM comments WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number");
- while ($comment = db_fetch_object($r3)) {
+ $r4 = db_query("SELECT score, votes FROM comments WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number");
+ while ($comment = db_fetch_object($r4)) {
$weight++;
$score += $weight * $comment->score;
$votes += $weight * $comment->votes;