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/admin/handler.go | |
| parent | e3502d9e649fe61bb0ba4046b2c23c0d78bc92e9 (diff) | |
| parent | 0c448f5d403a084389acb0b3d215f8728a599302 (diff) | |
| download | iosdc-japan-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.tar.gz iosdc-japan-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.tar.zst iosdc-japan-2025-albatross-fe8b14ccc77c829a2baa4034edb22daff9d5d8f8.zip | |
Merge branch 'feat/send-problem-before-starting-game'
Diffstat (limited to 'backend/admin/handler.go')
| -rw-r--r-- | backend/admin/handler.go | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/backend/admin/handler.go b/backend/admin/handler.go index 7239b08..d540f57 100644 --- a/backend/admin/handler.go +++ b/backend/admin/handler.go @@ -196,16 +196,14 @@ func (h *Handler) postGameEdit(c echo.Context) error { if err != nil { return echo.NewHTTPError(http.StatusBadRequest, "Invalid duration_seconds") } - var problemID *int + var problemID int { problemIDRaw := c.FormValue("problem_id") - if problemIDRaw != "" { - problemIDInt, err := strconv.Atoi(problemIDRaw) - if err != nil { - return echo.NewHTTPError(http.StatusBadRequest, "Invalid problem_id") - } - problemID = &problemIDInt + problemIDInt, err := strconv.Atoi(problemIDRaw) + if err != nil { + return echo.NewHTTPError(http.StatusBadRequest, "Invalid problem_id") } + problemID = problemIDInt } var startedAt *time.Time { @@ -230,13 +228,6 @@ func (h *Handler) postGameEdit(c echo.Context) error { Valid: true, } } - var changedProblemID *int32 - if problemID == nil { - changedProblemID = nil - } else { - changedProblemID = new(int32) - *changedProblemID = int32(*problemID) - } { // TODO: @@ -255,7 +246,7 @@ func (h *Handler) postGameEdit(c echo.Context) error { DisplayName: displayName, DurationSeconds: int32(durationSeconds), StartedAt: changedStartedAt, - ProblemID: changedProblemID, + ProblemID: int32(problemID), }) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) |
