fix(leaderboard): align leaderboard API response parsing and podium rankings
@Rithish-2914 がすでに取り組んでいます。
2026年9月18日 から。
評価
この issue はまだ評価されていません。
説明
Problem
Problem
The Admin Leaderboard page (/leaderboard) fails to display participant rankings and podium standings due to API response structure mismatches:
-
Empty Leaderboard & Undefined Data:
getLeaderboard()insrc/api/users.tsexpects{ status: string, leaderboard: LeaderboardUser[] }and returnsresponse.data.leaderboard.- The backend
GET /admin/leaderboardreturns{ "message": "Leaderboard fetched successfully", "data": [ LeaderboardEntry... ] }. - Because
response.data.leaderboardisundefined, the query returnsundefined, leaving the podium and rest-of-the-field rankings blank.
-
Field Mapping:
- Backend returns
rank,id,name,email,reg_no,score,round_qualified,total_runtime,total_submissions,solved_count,is_banned. - Frontend accessors require clean mapping into
LeaderboardUserrecords.
- Backend returns
-
Podium Edge Cases:
- The top 3 podium layout should gracefully handle cases where fewer than 3 users have submitted solutions.
Steps to Reproduce
- Start the backend and log into the Admin portal (
cookoff-admin-11.0). - Navigate to the Leader tab from the sidebar (
/leaderboard). - Observed Behavior: The leaderboard displays "No other participants yet" or an empty state because
response.data.leaderboardisundefined. - Inspect Network tab for
GET /admin/leaderboard: the backend returns{ "message": "...", "data": [...] }with snake_case fields. - Expected Behavior: Top 3 participants should be highlighted on the podium with gold/silver/bronze trophies, scores, and rankings, with the remaining participants listed in "The Rest of the Field" table.
Proposed solution
src/api/users.ts:- Define
RawLeaderboardEntryandnormalizeLeaderboardUserhelper. - Update
getLeaderboard()to unwrapresponse.data.datainto normalizedLeaderboardUser[].
- Define
src/app/(protected)/leaderboard/page.tsx:- Ensure podium and field rankings consume normalized properties safely.
- Unit Tests:
- Add unit test coverage in
src/api/__tests__/users.test.tsforgetLeaderboardandnormalizeLeaderboardUser.
- Add unit test coverage in
Alternatives considered
No response
- 主要言語
- TypeScript
- スター
- 0
- フォーク
- 1
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
CodeChefVIT/cookoff-admin-11.0 のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
enhancement
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
-
fix(users): add target round and role payload to user upgrade endpoint再び着手できるかも @Rithish-2914 が 54 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
CodeChefVIT/cookoff-admin-11.0#22 · 担当者 1 名 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
CodeChefVIT/cookoff-admin-11.0 の issue をすべて見る
似ている issue
-
nb stats: the high-error-rate anomaly and the error-causes line give different cause splits for the same errors対応中かも @jeanibarz が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 89/100
jeanibarz/agent-notebook#418 ·
メンテナーはふだん 1 日以内に返信
-
Page sections overlap each other on every page (e.g. Seasons, Actors and Reviews on show pages)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
josephfung/curia#2563 ·
メンテナーはふだん 1 日以内に返信
-
README demo: offer a controlled video variant next to the GIF for reduced motion and mobile dataオープンaccessibility
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
onetechgroupll/eigen-beam#26 ·
メンテナーはふだん 1 日以内に返信
-
maintenance
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
killi199/time-tracking#532 ·
メンテナーはふだん 1 日以内に返信