Skip to content

Feature/add global ranking#120

Open
Yashaswini-K-P wants to merge 6 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/add-global-ranking
Open

Feature/add global ranking#120
Yashaswini-K-P wants to merge 6 commits into
codepvg:mainfrom
Yashaswini-K-P:feature/add-global-ranking

Conversation

@Yashaswini-K-P
Copy link
Copy Markdown
Contributor

Description

This PR extends the /api/student/:username endpoint by adding the user's live LeetCode Global Ranking to the API response payload.

Previously, while problem metrics were tracked historically via GitHub repositories, the absolute global leaderboard ranking was not exposed to the student profile layout. This change fetches the most recent global ranking dynamically from the LeetCode API, updates the response body structure gracefully, and implements zero-value fallbacks if the upstream service is unreachable—ensuring complete backward compatibility.

Linked Issue

Fixes #92

Changes Made

  • Direct API Upstream Fetching: Configured fetchStudentHistory to initially hit the leetcode-api-dun.vercel.app wrapper to capture the live, un-mutated ranking integer on-demand.
  • Resilient Graceful Degradation: Added fallback error handling to default the ranking parameter to 0 or retrieve it sequentially from historical repositories if the upstream wrapper times out or fails.
  • Payload Extension: Modified the return utility signature to inject the root-level ranking key directly alongside username and history data to align with frontend consumption criteria.

Type of Change

  • Bug fix
  • New feature
  • UI/Visual update
  • Documentation update
  • Refactor

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally using Prettier
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 7, 2026

Thank you for submitting a pull request.

Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully.

A maintainer will review your submission shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Global Ranking to /api/student/:username Response

1 participant