track switches by player

This commit is contained in:
xeals 2023-03-27 20:19:58 +11:00
parent ef70128552
commit e1b5d3abb0
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

10
main.py
View File

@ -46,8 +46,8 @@ def _init_db(conn: sqlite3.Connection):
UNIQUE(game, turn, player, user) UNIQUE(game, turn, player, user)
); );
CREATE TABLE IF NOT EXISTS switches( CREATE TABLE IF NOT EXISTS switches(
game, turn, name, game, turn, player, name,
UNIQUE(game, turn, name) UNIQUE(game, turn, player, name)
); );
CREATE TABLE IF NOT EXISTS nicknames( CREATE TABLE IF NOT EXISTS nicknames(
game, player, name, specie, game, player, name, specie,
@ -100,11 +100,11 @@ def parse_log(game: str, log: str, into: sqlite3.Connection):
player, name = resolve_mon(name) player, name = resolve_mon(name)
conn.execute( conn.execute(
""" """
INSERT INTO switches(game, turn, name) INSERT INTO switches(game, turn, player, name)
VALUES (?, ?, ?) VALUES (?, ?, ?, ?)
ON CONFLICT DO NOTHING ON CONFLICT DO NOTHING
""", """,
(game, turn, name), (game, turn, player, name),
) )
conn.execute( conn.execute(
""" """