mirror of
https://github.com/FAUSheppy/open-web-leaderboard.git
synced 2025-12-06 07:01:36 +01:00
implement simple last game check for now
This commit is contained in:
@@ -29,7 +29,7 @@ class DatabaseConnection:
|
|||||||
'''Get the total number of players in the database'''
|
'''Get the total number of players in the database'''
|
||||||
|
|
||||||
cursor = self.connPlayers.cursor()
|
cursor = self.connPlayers.cursor()
|
||||||
cursor.execute("SELECT Count(*) FROM players where games >= 10")
|
cursor.execute("SELECT Count(*) FROM players where games >= 10 and not lastgame is null")
|
||||||
count = cursor.fetchone()[0]
|
count = cursor.fetchone()[0]
|
||||||
return count
|
return count
|
||||||
|
|
||||||
@@ -78,6 +78,7 @@ class DatabaseConnection:
|
|||||||
cursor = self.connPlayers.cursor()
|
cursor = self.connPlayers.cursor()
|
||||||
limit = end - start
|
limit = end - start
|
||||||
sqlQuery = '''Select * FROM players where games >= 10
|
sqlQuery = '''Select * FROM players where games >= 10
|
||||||
|
and not lastgame is null
|
||||||
ORDER BY (mu - 2*sigma) DESC LIMIT ? OFFSET ?'''
|
ORDER BY (mu - 2*sigma) DESC LIMIT ? OFFSET ?'''
|
||||||
cursor.execute(sqlQuery, (limit, start))
|
cursor.execute(sqlQuery, (limit, start))
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
@@ -113,7 +114,9 @@ class DatabaseConnection:
|
|||||||
cursor = self.connPlayers.cursor()
|
cursor = self.connPlayers.cursor()
|
||||||
if(player.games < 10):
|
if(player.games < 10):
|
||||||
return -1
|
return -1
|
||||||
cursor.execute("SELECT COUNT(*) from players where games >= 10 and (mu-2*sigma) > (?-2*?);",
|
cursor.execute('''SELECT COUNT(*) from players where games >= 10
|
||||||
|
and not lastgame is null
|
||||||
|
and (mu-2*sigma) > (?-2*?);''',
|
||||||
(player.mu, player.sigma))
|
(player.mu, player.sigma))
|
||||||
rank = cursor.fetchone()[0]
|
rank = cursor.fetchone()[0]
|
||||||
return rank
|
return rank
|
||||||
|
|||||||
Reference in New Issue
Block a user