Exemplo n.º 1
0
def ten_winners():
    winners = dbutils.queryAll(
        """SELECT player, count(*) as c FROM playergame WHERE
                               status = 'won'
                               GROUP BY player
                               ORDER BY c desc
                               limit 10""")
    print(winners)
    return winners
Exemplo n.º 2
0
def getAllGames():
    return dbutils.queryAll("SELECT * FROM game")
Exemplo n.º 3
0
def getReadyPlayers(game_id):
    return dbutils.queryAll(
        "SELECT * FROM playergame WHERE game = '{}' AND status = 'ready'".
        format(game_id))
Exemplo n.º 4
0
def getGamePlayers(game_id):
    return dbutils.queryAll(
        "SELECT * FROM playergame where game = {} ORDER BY created".format(
            game_id))
Exemplo n.º 5
0
def getOpenGames():
    return dbutils.queryAll("SELECT * FROM game WHERE status = 'open'")
Exemplo n.º 6
0
def getFailedGames():
    return dbutils.queryAll("SELECT * FROM game WHERE status = 'failed'")
Exemplo n.º 7
0
def getWonGames():
    return dbutils.queryAll("SELECT * FROM game WHERE status = 'won'")
Exemplo n.º 8
0
def getHighScores():
    high_scores = dbutils.queryAll(
        "SELECT * FROM (SELECT player, count(status) as wins FROM playergame WHERE status = \"won\" GROUP BY player) AS ct ORDER BY ct.wins desc LIMIT 10"
    )
    return high_scores