- 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 nodes3-00
parent
a45fc1a20e
commit
4f07fe1a01
|
|
@ -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 score, votes FROM comments WHERE author = '$rating->id' AND (". time() ." - timestamp < $period) ORDER BY timestamp LIMIT $number");
|
||||
while ($comment = db_fetch_object($r3)) {
|
||||
$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;
|
||||
}
|
||||
|
||||
$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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue