Exemplo n.º 1
0
def get_latest_session():
    session = database.fetchone(
        "SELECT * FROM training_sessions WHERE episodeCount > 0 ORDER BY startTime DESC"
    )

    if session:
        return formatter.format(session)
Exemplo n.º 2
0
def get_active_session():
    session = database.fetchone(
        "SELECT * FROM training_sessions WHERE deactivated = 0 AND endTime IS NULL AND startTime IS NOT NULL LIMIT 1"
    )

    if session:
        return formatter.format(session)
Exemplo n.º 3
0
def get_next():
    tournament = database.fetchone(
        "SELECT * FROM tournaments WHERE startTime IS NULL ORDER BY id ASC")

    if tournament:
        return formatter.format(tournament)
Exemplo n.º 4
0
def get(id):
    tournament = database.fetchone("SELECT * FROM tournaments WHERE id = ?",
                                   id)

    return formatter.format(tournament)
Exemplo n.º 5
0
def is_active(id):
    return not not database.fetchone(
        "SELECT id FROM training_sessions WHERE deactivated = 0 AND endTime IS NULL AND startTime IS NOT NULL"
    )
Exemplo n.º 6
0
def get(id):
    game = database.fetchone("SELECT * FROM tournament_games WHERE id = ?",
                             (id, ))

    return formatter.format(game)