fix(leaderboard): align leaderboard API response parsing and podium rankings
@Rithish-2914 ya está trabajando en esto.
Desde el 18/9/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 0
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CodeChefVIT/cookoff-admin-11.0
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
fix(submissions): consume flat UserSubmissionResponse[] instead of nested .submission/.resultsAbiertoenhancement
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
fix(users): add target round and role payload to user upgrade endpointQuizá libre de nuevo @Rithish-2914 la tomó hace 54 días y no hay ningún pull request abierto. Abiertoenhancement
CodeChefVIT/cookoff-admin-11.0#22 · 1 asignado ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Todos los issues de CodeChefVIT/cookoff-admin-11.0
Issues similares
-
nb stats: the high-error-rate anomaly and the error-causes line give different cause splits for the same errorsPosiblemente ocupada @jeanibarz la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 89/100
jeanibarz/agent-notebook#418 ·
Los mantenedores suelen responder en 1 día
-
Page sections overlap each other on every page (e.g. Seasons, Actors and Reviews on show pages)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
josephfung/curia#2563 ·
Los mantenedores suelen responder en 1 día
-
README demo: offer a controlled video variant next to the GIF for reduced motion and mobile dataAbiertoaccessibility
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
onetechgroupll/eigen-beam#26 ·
Los mantenedores suelen responder en 1 día
-
maintenance
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
killi199/time-tracking#532 ·
Los mantenedores suelen responder en 1 día