From 125e26b4d5c986f8531c098ecd5d291c1e1c7a76 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 11 Aug 2024 20:39:48 +0900 Subject: feat(backend): make `games.problem_id` non-null --- backend/game/hub.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'backend/game/hub.go') diff --git a/backend/game/hub.go b/backend/game/hub.go index 54c559c..23fdd0d 100644 --- a/backend/game/hub.go +++ b/backend/game/hub.go @@ -693,16 +693,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)) -- cgit v1.2.3-70-g09d2