Fix: test

This commit is contained in:
Grail Finder
2025-07-11 14:18:10 +03:00
parent 7beccb84a2
commit 9a949757f2
2 changed files with 18 additions and 1 deletions

View File

@ -24,6 +24,23 @@ func setupPlayersTestDB(t *testing.T) (*sqlx.DB, func()) {
role TEXT, role TEXT,
is_bot BOOLEAN is_bot BOOLEAN
); );
CREATE TABLE player_stats (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT NOT NULL UNIQUE,
games_played INTEGER NOT NULL DEFAULT 0,
games_won INTEGER NOT NULL DEFAULT 0,
games_lost INTEGER NOT NULL DEFAULT 0,
opened_opposite_words INTEGER NOT NULL DEFAULT 0,
opened_white_words INTEGER NOT NULL DEFAULT 0,
opened_black_words INTEGER NOT NULL DEFAULT 0,
mime_winrate REAL NOT NULL DEFAULT 0.0,
guesser_winrate REAL NOT NULL DEFAULT 0.0,
played_as_mime INTEGER NOT NULL DEFAULT 0,
played_as_guesser INTEGER NOT NULL DEFAULT 0,
FOREIGN KEY (username) REFERENCES players(username) ON DELETE CASCADE
);
` `
_, err = db.Exec(schema) _, err = db.Exec(schema)
assert.NoError(t, err) assert.NoError(t, err)
@ -107,4 +124,3 @@ func TestPlayersRepo_DeletePlayer(t *testing.T) {
assert.NoError(t, err) assert.NoError(t, err)
assert.Equal(t, 0, count) assert.Equal(t, 0, count)
} }

View File

@ -35,6 +35,7 @@
- sql ping goroutine with reconnect on fail; + - sql ping goroutine with reconnect on fail; +
- player stats: played games, lost, won, rating elo, opened opposite words, opened white words, opened black words. - player stats: played games, lost, won, rating elo, opened opposite words, opened white words, opened black words.
- at the end of the game, all colors should be revealed; - at the end of the game, all colors should be revealed;
- tracing;
#### sse points #### sse points
- clue sse update; - clue sse update;