From e454cb2661aa6feb8c58ea17b1a28b6698d08137 Mon Sep 17 00:00:00 2001 From: depreciate Date: Sun, 3 Feb 2019 23:26:27 +1030 Subject: [PATCH] my b --- ripple/userUtils.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ripple/userUtils.py b/ripple/userUtils.py index 2cdd8d7..11a794e 100644 --- a/ripple/userUtils.py +++ b/ripple/userUtils.py @@ -25,7 +25,7 @@ def getBeatmapTime(beatmapID): return p -def incrementPlaytime(userID, gameMode=0, length=0): +def incrementPlaytime(userID, gameMode=0, length=0, mode): modeForDB = gameModes.getGameModeForDB(gameMode) result = glob.db.fetch("SELECT playtime_{gm} as playtime FROM users_stats WHERE id = %s".format(gm=modeForDB), [userID]) if result is not None: @@ -33,6 +33,25 @@ def incrementPlaytime(userID, gameMode=0, length=0): else: print("something went wrong...") + +def incrementPlaytimeRX(userID, gameMode=0, length=0): + modeForDB = gameModes.getGameModeForDB(gameMode) + result = glob.db.fetch("SELECT playtime_{gm}_rx as playtime FROM users_stats WHERE id = %s".format(gm=modeForDB), [userID]) + if result is not None: + glob.db.execute("UPDATE users_stats SET playtime_{gm}_rx = %s WHERE id = %s".format(gm=modeForDB), [(int(result['playtime'])+int(length)), userID]) + else: + print("something went wrong...") + + +def incrementPlaytimeAP(userID, gameMode=0, length=0): + modeForDB = gameModes.getGameModeForDB(gameMode) + result = glob.db.fetch("SELECT playtime_{gm}_ap as playtime FROM users_stats WHERE id = %s".format(gm=modeForDB), [userID]) + if result is not None: + glob.db.execute("UPDATE users_stats SET playtime_{gm}_ap = %s WHERE id = %s".format(gm=modeForDB), [(int(result['playtime'])+int(length)), userID]) + else: + print("something went wrong...") + + def getUserStats(userID, gameMode): """ Get all user stats relative to `gameMode`