diff --git a/ghostratings/calculations.php b/ghostratings/calculations.php index ab05aaa14..4d31f9c6b 100644 --- a/ghostratings/calculations.php +++ b/ghostratings/calculations.php @@ -135,23 +135,23 @@ public function processGR() //First we need to grab everyones GR for this category to use in the calculations $userGR = array(); $peakGR = array(); - $monthYear = array(); + $yearMonth = array(); $grSum = 0; $first = True; - $date = date('my',$this->time); + $date = date('Ym',$this->time); foreach($this->SCcounts as $userID=>$scs) { $rating = $this->start; $peakRating = $rating; $userDate = $date; $sqlCount = "SELECT COUNT(1) FROM wD_GhostRatings WHERE categoryID=".$categoryID." AND userID=".$userID; - $sql = "SELECT rating, peakRating, monthYear FROM wD_GhostRatings WHERE categoryID=".$categoryID." AND userID=".$userID; + $sql = "SELECT rating, peakRating, yearMonth FROM wD_GhostRatings WHERE categoryID=".$categoryID." AND userID=".$userID; $inDB = 1; list($inDB) = $DB->sql_row($sqlCount); if ($inDB < 1) { - $DB->sql_put("INSERT INTO wD_GhostRatings(userID, categoryID, rating, peakrating, monthYear) VALUES(".$userID.", ".$categoryID.", ".$rating.", ".$peakRating.", ".$date.")"); - $DB->sql_put("INSERT INTO wD_GhostRatingsHistory(userID, categoryID, monthYear, rating) VALUES(".$userID.", ".$categoryID.", ".$date.", ".$rating.")"); + $DB->sql_put("INSERT INTO wD_GhostRatings(userID, categoryID, rating, peakrating, yearMonth) VALUES(".$userID.", ".$categoryID.", ".$rating.", ".$peakRating.", ".$date.")"); + $DB->sql_put("INSERT INTO wD_GhostRatingsHistory(userID, categoryID, yearMonth, rating) VALUES(".$userID.", ".$categoryID.", ".$date.", ".$rating.")"); } else { @@ -159,7 +159,7 @@ public function processGR() } $userGR[$userID] = $rating; $peakGR[$userID] = $peakRating; - $monthYear[$userID] = $userDate; + $yearMonth[$userID] = $userDate; $grSum += $rating; } $grAdjustment = array(); @@ -338,14 +338,14 @@ public function processGR() { $sqlUpdate = $sqlUpdate . ", peakRating=".$newRating; } - if ($date <> $monthYear[$userID]) + if ($date <> $yearMonth[$userID]) { - $sqlUpdate = $sqlUpdate. ", monthYear=".$date; - $DB->sql_put("INSERT INTO wD_GhostRatingsHistory(userID, categoryID, monthYear, rating) VALUES(".$userID.", ".$categoryID.", ".$date.", ".$newRating.")"); + $sqlUpdate = $sqlUpdate. ", yearMonth=".$date; + $DB->sql_put("INSERT INTO wD_GhostRatingsHistory(userID, categoryID, yearMonth, rating) VALUES(".$userID.", ".$categoryID.", ".$date.", ".$newRating.")"); } else { - $DB->sql_put("UPDATE wD_GhostRatingsHistory SET rating=".$newRating." WHERE userID=".$userID." AND categoryID=".$categoryID." AND monthYear=".$date." LIMIT 1"); + $DB->sql_put("UPDATE wD_GhostRatingsHistory SET rating=".$newRating." WHERE userID=".$userID." AND categoryID=".$categoryID." AND yearMonth=".$date." LIMIT 1"); } $sqlUpdate = $sqlUpdate . " WHERE categoryID=".$categoryID." AND userID=".$userID." LIMIT 1"; $DB->sql_put($sqlUpdate); diff --git a/install/1.65-1.66/update.sql b/install/1.65-1.66/update.sql index 64626c2b2..724d1529f 100644 --- a/install/1.65-1.66/update.sql +++ b/install/1.65-1.66/update.sql @@ -5,20 +5,20 @@ CREATE TABLE `wD_GhostRatings` ( `categoryID` mediumint(8) unsigned NOT NULL, `rating` FLOAT, `peakRating` FLOAT, -`monthYear` smallint(4) unsigned NOT NULL, +`yearMonth` mediumint(6) unsigned NOT NULL, INDEX ( `userID` ), INDEX ( `categoryID` ), -INDEX ( `monthYear` ) +INDEX ( `yearMonth` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `wD_GhostRatingsHistory` ( `userID` mediumint(8) unsigned NOT NULL, `categoryID` mediumint(8) unsigned NOT NULL, -`monthYear` smallint(4) unsigned NOT NULL, +`yearMonth` mediumint(6) unsigned NOT NULL, `rating` FLOAT, INDEX ( `userID` ), INDEX ( `categoryID` ), -INDEX ( `monthYear` ) +INDEX ( `yearMonth` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `wD_GhostRatingsBackup` ( diff --git a/install/FullInstall/fullInstall.sql b/install/FullInstall/fullInstall.sql index 6f84ebfba..ffcb4bc05 100755 --- a/install/FullInstall/fullInstall.sql +++ b/install/FullInstall/fullInstall.sql @@ -944,20 +944,20 @@ CREATE TABLE `wD_GhostRatings` ( `categoryID` mediumint(8) unsigned NOT NULL, `rating` FLOAT, `peakRating` FLOAT, -`monthYear` smallint(4) unsigned NOT NULL, +`yearMonth` mediumint(6) unsigned NOT NULL, INDEX ( `userID` ), INDEX ( `categoryID` ), -INDEX ( `monthYear` ) +INDEX ( `yearMonth` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `wD_GhostRatingsHistory` ( `userID` mediumint(8) unsigned NOT NULL, `categoryID` mediumint(8) unsigned NOT NULL, -`monthYear` smallint(4) unsigned NOT NULL, +`yearMonth` mediumint(6) unsigned NOT NULL, `rating` FLOAT, INDEX ( `userID` ), INDEX ( `categoryID` ), -INDEX ( `monthYear` ) +INDEX ( `yearMonth` ) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `wD_GhostRatingsBackup` (