aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/api
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
parent7e94e4d2f8ccce36165cd5f2a092a2ba7645d69c (diff)
downloadiosdc-japan-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.tar.gz
iosdc-japan-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.tar.zst
iosdc-japan-2025-albatross-3ea0b8e93ea2735feacc8b7253bc0b32a5aa2bb6.zip
feat: show code in ranking page
Diffstat (limited to 'backend/api')
-rw-r--r--backend/api/generated.go55
-rw-r--r--backend/api/handler.go3
2 files changed, 31 insertions, 27 deletions
diff --git a/backend/api/generated.go b/backend/api/generated.go
index a6ba8ba..8a74b01 100644
--- a/backend/api/generated.go
+++ b/backend/api/generated.go
@@ -80,9 +80,10 @@ type Problem struct {
// RankingEntry defines model for RankingEntry.
type RankingEntry struct {
- Player User `json:"player"`
- Score int `json:"score"`
- SubmittedAt int64 `json:"submitted_at"`
+ Code nullable.Nullable[string] `json:"code"`
+ Player User `json:"player"`
+ Score int `json:"score"`
+ SubmittedAt int64 `json:"submitted_at"`
}
// User defines model for User.
@@ -1129,30 +1130,30 @@ func (sh *strictHandler) PostLogin(ctx echo.Context) error {
// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{
- "H4sIAAAAAAAC/+xYXW/UOBf+K5bfV+ImNFNaVWz3quwCYoXQCBatVghFnuTMjItjB9thOovy31e28+XE",
- "6aSFsttqe1FNEp/vx4/P8VecirwQHLhW+PwrLogkOWiQ9mkLJAOZkFJvhaR/EU0FN+8px+f1RxxhTnLA",
- "5/jCWxVhCZ9LKiHD51qWEGGVbiEnRlzvCyOgtKR8g6sq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Om+AvAMM",
+ "zIt8INKzAn1hXfzDImwoTg9TtJOjD4mXoBGpFQ5AIjbJJ24KZCFUAB1L4frDJSP7X1y/84/BxA56z0S2",
+ "/waE3LLLCXV+Ybj4Tx5VGN4+pt65GXBdMrZHZZER3YDlX48wAw+kt4CYnSSQdcw01typRDXDxnUJySDO",
+ "zSduNnkI+ak1/LoENRzKhuBzTOYkqz9FKZvIGIuQI70/yauHLGiGMSRBlUyjtZCo7nKnAee63nnp7Z07",
+ "+1+Cu9sE1w4i9wSHDhYWivVbXxBuO6LTrZfgDvbRfxiSXopTDyfH2V8ky6ghIWzpnbhR8htjMJAN5zXp",
+ "F4z1M0qXEZVp3c1OTihHzYPZPerxbmjYNH6le0uZhdz63eVBgLZn96zx0XtzOjRGNsznYHRpY4QakntZ",
+ "qouBDQZuTGzcY850HX5tj3yvOlgQpXZC+u867erxkxM88Rb0DQ88vJmja9HfUEBvabUWn2DwXnxl/o56",
+ "/w+a4pjMQatX2A0CgWuj6q2Luwer9wokcsCpqqr6OwAA//9YsFelAR8AAA==",
}
// GetSwagger returns the content of the embedded swagger specification file
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{