highscores sorted by name secondarily

This commit is contained in:
Leander
2017-04-25 13:33:58 +02:00
parent f6878779f2
commit 5a50135ae9

View File

@@ -15,7 +15,7 @@ $offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$db = new Database();
if($cid == -1) {
$overview = $db->query('SELECT "name", "highscore" FROM "Users" ORDER BY "highscore" DESC
$overview = $db->query('SELECT "name", "highscore" FROM "Users" ORDER BY "highscore" DESC, "name" ASC
LIMIT $1 OFFSET $2', array($limit, $offset))['data'];
foreach($overview as $row) {
$name = $row['name'];
@@ -24,11 +24,6 @@ if($cid == -1) {
$data[] = array('place' => $place, 'name' => $name, 'score' => $score);
}
} else {
/*$overview = $db->query('SELECT u."name", COALESCE(h."score", -1) AS "score"
FROM "Users" u RIGHT OUTER JOIN "Highscores" h ON u."ID" = h."Users_ID"
WHERE h."Categories_ID" = $1
ORDER BY COALESCE(h."score", -1) DESC
LIMIT $2 OFFSET $3', array($cid, $limit, $offset))['data'];*/
$overview = $db->query('SELECT u."name", COALESCE(h."score", -1) AS "c_score"
FROM "Users" u LEFT OUTER JOIN
(SELECT "Users_ID", "score"