Created quiz leaderboard

This commit is contained in:
2020-11-14 15:09:14 +01:00
parent 75802142e8
commit e23ddf049b
2 changed files with 41 additions and 13 deletions

View File

@@ -77,6 +77,12 @@ class QuizPlayersDB:
cursor.execute(sql)
self.discorddbconn.get_db().commit()
def get_top_players(self, limit = 20):
cursor = self.discorddbconn.get_cursor(dictionary=True)
sql = f"SELECT discordid, wins as stat FROM {self.tablename} ORDER BY wins DESC LIMIT {str(limit)}"
cursor.execute(sql)
return list(cursor.fetchall())
def close(self):
self.discorddbconn.close()
@@ -209,7 +215,6 @@ class PlayerDBLinker:
serverdb_cursor.execute(sql)
return list(serverdb_cursor.fetchall())
def close(self):
self.discorddbconn.close()
self.serverdbconn.close()