diff --git a/repos/players_test.go b/repos/players_test.go index e532194..62d3f4e 100644 --- a/repos/players_test.go +++ b/repos/players_test.go @@ -24,6 +24,23 @@ func setupPlayersTestDB(t *testing.T) (*sqlx.DB, func()) { role TEXT, 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) assert.NoError(t, err) @@ -107,4 +124,3 @@ func TestPlayersRepo_DeletePlayer(t *testing.T) { assert.NoError(t, err) assert.Equal(t, 0, count) } - diff --git a/todos.md b/todos.md index 92987da..3f1fb02 100644 --- a/todos.md +++ b/todos.md @@ -35,6 +35,7 @@ - sql ping goroutine with reconnect on fail; + - 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; +- tracing; #### sse points - clue sse update;