This commit is contained in:
depreciate 2019-02-03 23:26:27 +10:30
parent 7336201a5f
commit e454cb2661

View File

@ -25,7 +25,7 @@ def getBeatmapTime(beatmapID):
return p return p
def incrementPlaytime(userID, gameMode=0, length=0): def incrementPlaytime(userID, gameMode=0, length=0, mode):
modeForDB = gameModes.getGameModeForDB(gameMode) modeForDB = gameModes.getGameModeForDB(gameMode)
result = glob.db.fetch("SELECT playtime_{gm} as playtime FROM users_stats WHERE id = %s".format(gm=modeForDB), [userID]) result = glob.db.fetch("SELECT playtime_{gm} as playtime FROM users_stats WHERE id = %s".format(gm=modeForDB), [userID])
if result is not None: if result is not None:
@ -33,6 +33,25 @@ def incrementPlaytime(userID, gameMode=0, length=0):
else: else:
print("something went wrong...") 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): def getUserStats(userID, gameMode):
""" """
Get all user stats relative to `gameMode` Get all user stats relative to `gameMode`