T201704101138

This commit is contained in:
Leander
2017-04-10 11:38:29 +02:00
parent 63a67194ca
commit 766b226f84
2 changed files with 2 additions and 4 deletions

View File

@@ -60,7 +60,7 @@ if($uid == '') {
}
$old_high = $db->query('SELECT "score" FROM "Highscores" WHERE "Users_ID" = $1 AND "Categories_ID" = $2',
array($uid, $cid))['data'][0]['score'];
$new_high = round($old_high * 0.95 + $score * 0.05);
$new_high = $old_high == 0 ? $score : round($old_high * 0.95 + $score * 0.05);
$db->query('UPDATE "Highscores" SET "score" = $1 WHERE "Users_ID" = $2 AND "Categories_ID" = $3',
array($new_high, $uid, $cid));