Beispiel #1
0
def find(id):
    select = """
    select p.fname, p.id, a.score, m.entered_time 
    from player p, attempt a, match m
    where p.id = a.player_id 
    and a.match_id = ?
    and m.id = a.match_id
    """
    m = Match(id=id)
    cur = g.db.execute(select, [id])
    attempts = cur.fetchall()
    player1 = Player(*attempts[0][:2])
    m.player1 = player1
    m.score1 = attempts[0][2]
    player2 = Player(*attempts[1][:2])
    m.player2 = player2
    m.score2 = attempts[1][2]
    m.entered_time = attempts[0][-1]
    return m