diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-08-16 07:37:03 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-08-16 07:37:03 +0000 |
commit | e04f6d2328820cded0c853888fdea57119a8fee2 (patch) | |
tree | 75598f8d1c651dd4692b580bc925904aec681ce7 | |
parent | fc143e79a77973671b4a82e0cca817747e3b15d0 (diff) | |
download | brdo-e04f6d2328820cded0c853888fdea57119a8fee2.tar.gz brdo-e04f6d2328820cded0c853888fdea57119a8fee2.tar.bz2 |
- Made the rating module and its SQL table ASNI compliant. Patch by jaa.
-rw-r--r-- | database/database.mysql | 4 | ||||
-rw-r--r-- | modules/rating.module | 4 | ||||
-rw-r--r-- | update.php | 8 |
3 files changed, 11 insertions, 5 deletions
diff --git a/database/database.mysql b/database/database.mysql index 7337be7c3..fa6eba04e 100644 --- a/database/database.mysql +++ b/database/database.mysql @@ -318,8 +318,8 @@ CREATE TABLE poll_choices ( CREATE TABLE rating ( uid int(10) NOT NULL default '0', - new int(6) NOT NULL default '0', - old int(6) NOT NULL default '0', + current int(6) NOT NULL default '0', + previous int(6) NOT NULL default '0', PRIMARY KEY (uid) ) TYPE=MyISAM; diff --git a/modules/rating.module b/modules/rating.module index 4f8fe48be..ae869304e 100644 --- a/modules/rating.module +++ b/modules/rating.module @@ -52,7 +52,7 @@ function rating_cron() { $r2 = db_query("SELECT uid FROM users ORDER BY rating DESC"); while ($account = db_fetch_object($r2)) { - db_query("INSERT INTO rating (uid, new, old) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')"); + db_query("INSERT INTO rating (uid, current, previous) VALUES ('$account->uid', '". ++$j ."', '". $rating[$account->uid] ."')"); } } } @@ -81,7 +81,7 @@ function rating_list($limit) { $output .= "<table cellpadding=\"1\" cellspacing=\"1\">\n"; while ($account = db_fetch_object($result)) { - $ranking = $account->old - $account->new; + $ranking = $account->previous - $account->current; $output .= "<tr><td align=\"right\">". ++$i .".</td><td>". format_name($account) ."</td><td align=\"right\">". check_output($account->rating) ."</td><td>(". ($ranking < 0 ? "" : "+") ."$ranking)</td></tr>"; } $output .= "</table>\n"; diff --git a/update.php b/update.php index 82c70c465..302ab3fab 100644 --- a/update.php +++ b/update.php @@ -47,7 +47,8 @@ $mysql_updates = array( "2002-06-22" => "update_32", "2002-07-07" => "update_33", "2002-07-31" => "update_34", - "2002-08-10" => "update_35" + "2002-08-10" => "update_35", + "2002-08-16" => "update_36" ); // Update functions @@ -502,6 +503,11 @@ function update_35() { update_sql("ALTER TABLE poll_choices ADD INDEX (nid);"); } +function update_36() { + update_sql("ALTER TABLE rating CHANGE old previous int(6) NOT NULL default '0';"); + update_sql("ALTER TABLE rating CHANGE new current int(6) NOT NULL default '0';"); +} + function update_upgrade3() { update_sql("INSERT INTO system VALUES ('archive.module','archive','module','',1);"); update_sql("INSERT INTO system VALUES ('block.module','block','module','',1);"); |