diff --git a/main.py b/main.py index c0b6f5a..12a7c7c 100755 --- a/main.py +++ b/main.py @@ -83,7 +83,7 @@ def _init_db(conn: sqlite3.Connection): UNIQUE(game, turn, player) ); CREATE TABLE IF NOT EXISTS games( - id, p1, p2, format, uploadtime, + id, p1, p2, format, uploadtime, winner, UNIQUE(id) ) """ @@ -163,6 +163,15 @@ def parse_log(game: str, log: str, into: sqlite3.Connection): """, (game, turn, player, mon), ) + case ["win", player]: + conn.execute( + """ + UPDATE games + SET winner = ? + WHERE id = ? + """, + (player, game), + ) case ["-sidestart", side, env]: if not last_move: LOG.warning(f"missing previous move for {line}")