Skip to content

Commit

Permalink
Closes #347
Browse files Browse the repository at this point in the history
  • Loading branch information
truell20 committed Dec 23, 2016
1 parent dfd49ca commit 2f591af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions website/api/manager/ManagerAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ protected function game() {
$s3Client->putObject($args);
}


// Check that we arent stoing too many games in db
$numAllowed = 100000;
$res = mysqli_query($this->mysqli, "SELECT * FROM Game");
Expand Down Expand Up @@ -256,10 +255,13 @@ protected function game() {
usort($allUsers, function($a, $b) {
return $a['mu']-3*$a['sigma'] < $b['mu']-3*$b['sigma'];
});
$query = "UPDATE User set rank = CASE";
for($userIndex = 0; $userIndex < count($allUsers); $userIndex++) {
$rank = $userIndex+1;
$this->insert("UPDATE User SET rank={$rank} WHERE userID={$allUsers[$userIndex]['userID']}");
$query .= " WHEN userID = {$allUsers[$userIndex]['userID']} THEN {$rank}";
}
$query .= " ELSE rank END;";
$this->insert($query);
}
}

Expand Down

0 comments on commit 2f591af

Please sign in to comment.