From 23315cc2e0c98510ffca5adf06a2152945e51756 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 20 Mar 2025 20:44:49 +0900 Subject: fix(backend): fix online qualifying ranking --- backend/admin/handler.go | 1 + backend/admin/templates/online_qualifying_ranking.html | 9 ++++++--- backend/db/query.sql.go | 3 +++ backend/query.sql | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/backend/admin/handler.go b/backend/admin/handler.go index 161f85c..c0ddd43 100644 --- a/backend/admin/handler.go +++ b/backend/admin/handler.go @@ -413,6 +413,7 @@ func (h *Handler) getOnlineQualifyingRanking(c echo.Context) error { entries[i] = echo.Map{ "Rank": i + 1, "Username": r.Username, + "UserLabel": r.UserLabel, "Score1": r.CodeSize1, "Score2": r.CodeSize2, "TotalScore": r.TotalCodeSize, diff --git a/backend/admin/templates/online_qualifying_ranking.html b/backend/admin/templates/online_qualifying_ranking.html index 3b00046..039687e 100644 --- a/backend/admin/templates/online_qualifying_ranking.html +++ b/backend/admin/templates/online_qualifying_ranking.html @@ -10,15 +10,18 @@ 順位 プレイヤー - スコア - 提出時刻 + スコア1 + スコア2 + 合計スコア + 提出時刻1 + 提出時刻2 {{ range .Entries }} {{ .Rank }} - {{ .Username }} + {{ .Username }}{{ if .UserLabel }} ({{ .UserLabel }}){{ end }} {{ .Score1 }} {{ .Score2 }} {{ .TotalScore }} diff --git a/backend/db/query.sql.go b/backend/db/query.sql.go index a478b69..abf2631 100644 --- a/backend/db/query.sql.go +++ b/backend/db/query.sql.go @@ -276,6 +276,7 @@ func (q *Queries) GetLatestStatesOfMainPlayers(ctx context.Context, gameID int32 const getQualifyingRanking = `-- name: GetQualifyingRanking :many SELECT u.username AS username, + u.label AS user_label, s1.code_size AS code_size_1, s2.code_size AS code_size_2, (s1.code_size + s2.code_size) AS total_code_size, @@ -297,6 +298,7 @@ type GetQualifyingRankingParams struct { type GetQualifyingRankingRow struct { Username string + UserLabel *string CodeSize1 int32 CodeSize2 int32 TotalCodeSize int32 @@ -315,6 +317,7 @@ func (q *Queries) GetQualifyingRanking(ctx context.Context, arg GetQualifyingRan var i GetQualifyingRankingRow if err := rows.Scan( &i.Username, + &i.UserLabel, &i.CodeSize1, &i.CodeSize2, &i.TotalCodeSize, diff --git a/backend/query.sql b/backend/query.sql index 4707eff..c052718 100644 --- a/backend/query.sql +++ b/backend/query.sql @@ -135,6 +135,7 @@ ORDER BY submissions.code_size ASC, submissions.created_at ASC; -- name: GetQualifyingRanking :many SELECT u.username AS username, + u.label AS user_label, s1.code_size AS code_size_1, s2.code_size AS code_size_2, (s1.code_size + s2.code_size) AS total_code_size, -- cgit v1.2.3-70-g09d2