- the rating module now thinks in terms of nodes: every new node type that

extends node will automatically get involved in the rating game so not
  just the stories only. ;-)
3-00
Dries Buytaert 2001-03-24 16:42:43 +00:00
parent fd659b51fa
commit 006b1e48fd
1 changed files with 3 additions and 4 deletions

View File

@ -14,7 +14,7 @@ function rating_cron() {
while ($rating = db_fetch_object($r1)) {
unset($bonus); unset($votes); unset($score); unset($value); unset($weight);
$r2 = db_query("SELECT COUNT(id) AS number FROM stories 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 = 2");
if ($story = db_fetch_object($r2)) {
$bonus = $story->number;
}
@ -31,13 +31,12 @@ function rating_cron() {
db_query("UPDATE users SET rating = '$value' WHERE id = '$rating->id'");
}
}
}
function rating_help() {
?>
<H3>User rating</H3>
<P>The rating cron will periodically calculate an overall rating of each user's contributed value that is a time-weighted average of his or her comments ratings with an additional bonus for the stories he or she contributed. The system can be best compared with <A HREF="http://slashcode.com/">SlashCode</A>'s karma and is - in fact - even more similar to <A HREF="http://scoop.kuro5hin.org/">Scoop</A>'s mojo implementation.</P>
<P>The rating cron will periodically calculate an overall rating of each user's contributed value that is a time-weighted average of his or her comments ratings with an additional bonus for the nodes he or she contributed. The system can be best compared with <A HREF="http://slashcode.com/">SlashCode</A>'s karma and is - in fact - even more similar to <A HREF="http://scoop.kuro5hin.org/">Scoop</A>'s mojo implementation.</P>
<P>I won't elaborate on all the funny math involved and it suffices to say that the actual weighting is done in such a way:</P>
<OL>
<LI>that comments with a lot of votes count more then comments with only one or two votes.</LI>
@ -45,7 +44,7 @@ function rating_help() {
</OL>
<P>The idea of (1) is that it favors comments that more people voted on, and thus whose rating is more likely to be accurate or justified.</P>
<P>The latter (2) makes the user rating that comes out of the calulations temporary, based on users' most recent activity and responsive to their current state. This is accomplished by taking each user's last 30 comments, or however many he or she posted in the last 60 days - whatever comes first.</P>
<P>Additionally, users that posted one or more succesful stories in the last 60 days gain extra bonus points which will boost up their overall rating.</P>
<P>Additionally, users that posted one or more succesful nodes in the last 60 days gain extra bonus points which will boost up their overall rating.</P>
<?php
}