aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/game/hub.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2024-08-11 20:39:48 +0900
committernsfisis <nsfisis@gmail.com>2024-08-11 20:39:48 +0900
commit125e26b4d5c986f8531c098ecd5d291c1e1c7a76 (patch)
treefee5d641a05dc972a6b80fb3620d156f13d9b137 /backend/game/hub.go
parente3502d9e649fe61bb0ba4046b2c23c0d78bc92e9 (diff)
downloadphperkaigi-2025-albatross-125e26b4d5c986f8531c098ecd5d291c1e1c7a76.tar.gz
phperkaigi-2025-albatross-125e26b4d5c986f8531c098ecd5d291c1e1c7a76.tar.zst
phperkaigi-2025-albatross-125e26b4d5c986f8531c098ecd5d291c1e1c7a76.zip
feat(backend): make `games.problem_id` non-null
Diffstat (limited to 'backend/game/hub.go')
-rw-r--r--backend/game/hub.go14
1 files changed, 4 insertions, 10 deletions
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))