summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-03-25 10:44:24 +0000
committerDries Buytaert <dries@buytaert.net>2001-03-25 10:44:24 +0000
commit4f07fe1a01e601ccf40aefd46467dd5dfe484e99 (patch)
tree3c6e41e37b2cf45a43e06dc715810e61173a1fa2 /modules
parenta45fc1a20e1e9b8bf64c286db7a672d3954e88d9 (diff)
downloadbrdo-4f07fe1a01e601ccf40aefd46467dd5dfe484e99.tar.gz
brdo-4f07fe1a01e601ccf40aefd46467dd5dfe484e99.tar.bz2
- a small change to the rating algorithm: you get only 1/2 a bonus point
for each succesful node and you loose 1/2 a bonus point for all dumped nodes
Diffstat (limited to 'modules')
-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;