Get ready for dbhelper switch
This commit is contained in:
parent
8b364d035e
commit
bc7624e001
2 changed files with 5 additions and 4 deletions
|
@ -57,7 +57,7 @@ module.exports = class {
|
|||
// Gets the user's score information from the database and caches it
|
||||
getNewUserInformationFromDatabase() {
|
||||
const userScoreDB = global.DatabaseHelper.getFromDB(`SELECT * FROM users_modes_info WHERE user_id = ${this.id} AND mode_id = ${this.playMode} LIMIT 1`);
|
||||
const userRankDB = global.DatabaseHelper.getFromDB(`SELECT user_id, pp_raw, ROW_NUMBER() OVER(ORDER BY pp_raw DESC) AS rank FROM users_modes_info WHERE mode_id = ${this.playMode} ORDER BY pp_raw DESC`);
|
||||
const userRankDB = global.DatabaseHelper.getFromDB(`SELECT user_id, pp_raw FROM users_modes_info WHERE mode_id = ${this.playMode} ORDER BY pp_raw DESC`);
|
||||
|
||||
if (userScoreDB == null || userRankDB == null) throw "fuck";
|
||||
|
||||
|
@ -70,8 +70,9 @@ module.exports = class {
|
|||
this.totalScore = userScoreDB.total_score;
|
||||
this.accuracy = userScoreDB.avg_accuracy;
|
||||
this.playCount = userScoreDB.playcount;
|
||||
for (let userRank of userRankDB)
|
||||
if (userRank["user_id"] == this.id) this.rank = userRank.rank;
|
||||
for (let i = 0; i < userRankDB.length; i++) {
|
||||
if (userRankDB[i]["user_id"] == this.id) this.rank = i + 1;
|
||||
}
|
||||
this.pp = userScoreDB.pp_raw;
|
||||
|
||||
if (userScoreUpdate) {
|
||||
|
|
|
@ -120,7 +120,7 @@ const ChangeAction = require("./Packets/ChangeAction.js"),
|
|||
// A class for managing everything multiplayer
|
||||
global.MultiplayerManager = new MultiplayerManager();
|
||||
|
||||
module.exports = function(req, res) {
|
||||
module.exports = async function(req, res) {
|
||||
// Add to requests for logging
|
||||
global.httpRequestsPerLogInterval++;
|
||||
|
||||
|
|
Loading…
Reference in a new issue