aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api/handler.go
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-03-29 01:51:53 +0900
committernsfisis <nsfisis@gmail.com>2025-03-29 01:51:53 +0900
commit3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6 (patch)
treec4766f3f0c23cedd80bf8d8042516ba428645e99 /backend/api/handler.go
parent7e94e4d2f8ccce36165cd5f2a092a2ba7645d69c (diff)
downloadphperkaigi-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.tar.gz
phperkaigi-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.tar.zst
phperkaigi-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.zip
feat: show code in ranking page
Diffstat (limited to 'backend/api/handler.go')
-rw-r--r--backend/api/handler.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/backend/api/handler.go b/backend/api/handler.go
index d498770..6561151 100644
--- a/backend/api/handler.go
+++ b/backend/api/handler.go
@@ -253,6 +253,8 @@ func (h *Handler) GetGameWatchRanking(ctx context.Context, request GetGameWatchR
}
ranking := make([]RankingEntry, len(rows))
for i, row := range rows {
+ // TODO: check if game is finished.
+ code := &row.Submission.Code
ranking[i] = RankingEntry{
Player: User{
UserID: int(row.User.UserID),
@@ -264,6 +266,7 @@ func (h *Handler) GetGameWatchRanking(ctx context.Context, request GetGameWatchR
},
Score: int(row.Submission.CodeSize),
SubmittedAt: row.Submission.CreatedAt.Time.Unix(),
+ Code: toNullable(code),
}
}
return GetGameWatchRanking200JSONResponse{