diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-08-11 20:53:17 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-08-11 20:53:17 +0900 |
| commit | fe8b14ccc77c829a2baa4034edb22daff9d5d8f8 (patch) | |
| tree | 37528798ede5a89b1a7be6c6ee2fec20395668a2 /backend/game/hub.go | |
| parent | e3502d9e649fe61bb0ba4046b2c23c0d78bc92e9 (diff) | |
| parent | 0c448f5d403a084389acb0b3d215f8728a599302 (diff) | |
| download | phperkaigi-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.tar.gz phperkaigi-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.tar.zst phperkaigi-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.zip | |
Merge branch 'feat/send-problem-before-starting-game'
Diffstat (limited to 'backend/game/hub.go')
| -rw-r--r-- | backend/game/hub.go | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/backend/game/hub.go b/backend/game/hub.go index 54c559c..b454bb5 100644 --- a/backend/game/hub.go +++ b/backend/game/hub.go @@ -611,13 +611,6 @@ func (hub *gameHub) startGame() error { for player := range hub.players { player.s2cMessages <- &playerMessageS2CPrepare{ Type: playerMessageTypeS2CPrepare, - Data: playerMessageS2CPreparePayload{ - Problem: api.Problem{ - ProblemID: 1, - Title: "the answer", - Description: "print 42", - }, - }, } } @@ -693,16 +686,10 @@ func (hubs *Hubs) RestoreFromDB(ctx context.Context) error { if row.StartedAt.Valid { startedAt = &row.StartedAt.Time } - var pr *problem - if row.ProblemID != nil { - if row.Title == nil || row.Description == nil { - panic("inconsistent data") - } - pr = &problem{ - problemID: int(*row.ProblemID), - title: *row.Title, - description: *row.Description, - } + pr := &problem{ + problemID: int(row.ProblemID), + title: row.Title, + description: row.Description, } // TODO: N+1 playerRows, err := hubs.q.ListGamePlayers(ctx, int32(row.GameID)) |
