track winners for each game
This commit is contained in:
parent
0218386906
commit
fd9f489835
11
main.py
11
main.py
@ -83,7 +83,7 @@ def _init_db(conn: sqlite3.Connection):
|
|||||||
UNIQUE(game, turn, player)
|
UNIQUE(game, turn, player)
|
||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS games(
|
CREATE TABLE IF NOT EXISTS games(
|
||||||
id, p1, p2, format, uploadtime,
|
id, p1, p2, format, uploadtime, winner,
|
||||||
UNIQUE(id)
|
UNIQUE(id)
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
@ -163,6 +163,15 @@ def parse_log(game: str, log: str, into: sqlite3.Connection):
|
|||||||
""",
|
""",
|
||||||
(game, turn, player, mon),
|
(game, turn, player, mon),
|
||||||
)
|
)
|
||||||
|
case ["win", player]:
|
||||||
|
conn.execute(
|
||||||
|
"""
|
||||||
|
UPDATE games
|
||||||
|
SET winner = ?
|
||||||
|
WHERE id = ?
|
||||||
|
""",
|
||||||
|
(player, game),
|
||||||
|
)
|
||||||
case ["-sidestart", side, env]:
|
case ["-sidestart", side, env]:
|
||||||
if not last_move:
|
if not last_move:
|
||||||
LOG.warning(f"missing previous move for {line}")
|
LOG.warning(f"missing previous move for {line}")
|
||||||
|
Loading…
Reference in New Issue
Block a user