Rename "getNewUserInformationFromDatabase" to "updateUserInfo"
This commit is contained in:
parent
c24e223dac
commit
3db2c62bb9
4 changed files with 5 additions and 9 deletions
|
@ -57,19 +57,19 @@ module.exports = function(User, Message, Stream, IsCalledFromMultiplayer = false
|
||||||
case "pp":
|
case "pp":
|
||||||
responseMessage = "Set ranking mode to pp";
|
responseMessage = "Set ranking mode to pp";
|
||||||
User.rankingMode = 0;
|
User.rankingMode = 0;
|
||||||
User.getNewUserInformationFromDatabase();
|
User.updateUserInfo(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "score":
|
case "score":
|
||||||
responseMessage = "Set ranking mode to score";
|
responseMessage = "Set ranking mode to score";
|
||||||
User.rankingMode = 1;
|
User.rankingMode = 1;
|
||||||
User.getNewUserInformationFromDatabase();
|
User.updateUserInfo(true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "acc":
|
case "acc":
|
||||||
responseMessage = "Set ranking mode to accuracy";
|
responseMessage = "Set ranking mode to accuracy";
|
||||||
User.rankingMode = 2;
|
User.rankingMode = 2;
|
||||||
User.getNewUserInformationFromDatabase();
|
User.updateUserInfo(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ module.exports = class {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gets the user's score information from the database and caches it
|
// Gets the user's score information from the database and caches it
|
||||||
async getNewUserInformationFromDatabase(forceUpdate = false) {
|
async updateUserInfo(forceUpdate = false) {
|
||||||
const userScoreDB = await global.DatabaseHelper.query(`SELECT * FROM users_modes_info WHERE user_id = ${this.id} AND mode_id = ${this.playMode} LIMIT 1`);
|
const userScoreDB = await global.DatabaseHelper.query(`SELECT * FROM users_modes_info WHERE user_id = ${this.id} AND mode_id = ${this.playMode} LIMIT 1`);
|
||||||
const mappedRankingMode = rankingModes[this.rankingMode];
|
const mappedRankingMode = rankingModes[this.rankingMode];
|
||||||
const userRankDB = await global.DatabaseHelper.query(`SELECT user_id, ${mappedRankingMode} FROM users_modes_info WHERE mode_id = ${this.playMode} ORDER BY ${mappedRankingMode} DESC`);
|
const userRankDB = await global.DatabaseHelper.query(`SELECT user_id, ${mappedRankingMode} FROM users_modes_info WHERE mode_id = ${this.playMode} ORDER BY ${mappedRankingMode} DESC`);
|
||||||
|
|
|
@ -79,7 +79,7 @@ module.exports = async function(req, res, loginInfo) {
|
||||||
NewUser.isTourneyUser = isTourneyClient;
|
NewUser.isTourneyUser = isTourneyClient;
|
||||||
|
|
||||||
// Get user's data from the database
|
// Get user's data from the database
|
||||||
NewUser.getNewUserInformationFromDatabase();
|
NewUser.updateUserInfo();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Save the user's location to their class for later use
|
// Save the user's location to their class for later use
|
||||||
|
|
|
@ -34,10 +34,6 @@ setInterval(() => {
|
||||||
// Logout this user, they're clearly gone.
|
// Logout this user, they're clearly gone.
|
||||||
if (Date.now() >= User.timeoutTime)
|
if (Date.now() >= User.timeoutTime)
|
||||||
Logout(User);
|
Logout(User);
|
||||||
|
|
||||||
// The user is still here
|
|
||||||
else
|
|
||||||
User.getNewUserInformationFromDatabase();
|
|
||||||
}
|
}
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue