From 3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 29 Mar 2025 01:51:53 +0900 Subject: feat: show code in ranking page --- backend/api/handler.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'backend/api/handler.go') 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{ -- cgit v1.2.3-70-g09d2