diff --git a/ripple/userUtils.py b/ripple/userUtils.py index 5156b42..5cb6109 100644 --- a/ripple/userUtils.py +++ b/ripple/userUtils.py @@ -61,7 +61,6 @@ def getUserStats(userID, gameMode): :return: dictionary with result """ modeForDB = gameModes.getGameModeForDB(gameMode) - # Get stats stats = glob.db.fetch("""SELECT ranked_score_{gm} AS rankedScore, @@ -86,15 +85,27 @@ def getUserStatsRx(userID, gameMode): :return: dictionary with result """ modeForDB = gameModes.getGameModeForDB(gameMode) + if ModeForDB == 3: + # Get stats + stats = glob.db.fetch("""SELECT + ranked_score_{gm} AS rankedScore, + avg_accuracy_{gm} AS accuracy, + playcount_{gm} AS playcount, + total_score_{gm} AS totalScore, + pp_{gm} AS pp + FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) + + # Get game rank + else: # Get stats - stats = glob.db.fetch("""SELECT - ranked_score_{gm}_rx AS rankedScore, - avg_accuracy_{gm}_rx AS accuracy, - playcount_{gm}_rx AS playcount, - total_score_{gm}_rx AS totalScore, - pp_{gm}_rx AS pp - FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) + stats = glob.db.fetch("""SELECT + ranked_score_{gm}_rx AS rankedScore, + avg_accuracy_{gm}_rx AS accuracy, + playcount_{gm}_rx AS playcount, + total_score_{gm}_rx AS totalScore, + pp_{gm}_rx AS pp + FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) # Get game rank stats["gameRank"] = getGameRankRx(userID, gameMode) @@ -111,15 +122,27 @@ def getUserStatsAp(userID, gameMode): :return: dictionary with result """ modeForDB = gameModes.getGameModeForDB(gameMode) + if ModeForDB == 3: + # Get stats + stats = glob.db.fetch("""SELECT + ranked_score_{gm} AS rankedScore, + avg_accuracy_{gm} AS accuracy, + playcount_{gm} AS playcount, + total_score_{gm} AS totalScore, + pp_{gm} AS pp + FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) + + # Get game rank + else: # Get stats - stats = glob.db.fetch("""SELECT - ranked_score_{gm}_ap AS rankedScore, - avg_accuracy_{gm}_ap AS accuracy, - playcount_{gm}_ap AS playcount, - total_score_{gm}_ap AS totalScore, - pp_{gm}_auto AS pp - FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) + stats = glob.db.fetch("""SELECT + ranked_score_{gm}_ap AS rankedScore, + avg_accuracy_{gm}_ap AS accuracy, + playcount_{gm}_ap AS playcount, + total_score_{gm}_ap AS totalScore, + pp_{gm}_auto AS pp + FROM users_stats WHERE id = %s LIMIT 1""".format(gm=modeForDB), [userID]) # Get game rank stats["gameRank"] = getGameRankAp(userID, gameMode)