Fix: test
This commit is contained in:
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
todos.md
1
todos.md
@ -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;
|
||||||
|
Reference in New Issue
Block a user