diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-03-20 20:44:49 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-03-20 20:44:49 +0900 |
| commit | 23315cc2e0c98510ffca5adf06a2152945e51756 (patch) | |
| tree | b5a743ff2adbcd5ccafeb06107b186218d201e18 | |
| parent | 4a2438201d0e365a873632a1ffcf913661eacbec (diff) | |
| download | phperkaigi-2025-albatross-23315cc2e0c98510ffca5adf06a2152945e51756.tar.gz phperkaigi-2025-albatross-23315cc2e0c98510ffca5adf06a2152945e51756.tar.zst phperkaigi-2025-albatross-23315cc2e0c98510ffca5adf06a2152945e51756.zip | |
fix(backend): fix online qualifying ranking
| -rw-r--r-- | backend/admin/handler.go | 1 | ||||
| -rw-r--r-- | backend/admin/templates/online_qualifying_ranking.html | 9 | ||||
| -rw-r--r-- | backend/db/query.sql.go | 3 | ||||
| -rw-r--r-- | 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 @@ <tr> <th scope="col">順位</th> <th scope="col">プレイヤー</th> - <th scope="col">スコア</th> - <th scope="col">提出時刻</th> + <th scope="col">スコア1</th> + <th scope="col">スコア2</th> + <th scope="col">合計スコア</th> + <th scope="col">提出時刻1</th> + <th scope="col">提出時刻2</th> </tr> </thead> <tbody> {{ range .Entries }} <tr> <td>{{ .Rank }}</td> - <td>{{ .Username }}</td> + <td>{{ .Username }}{{ if .UserLabel }} ({{ .UserLabel }}){{ end }}</td> <td>{{ .Score1 }}</td> <td>{{ .Score2 }}</td> <td>{{ .TotalScore }}</td> 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, |
