Skip to content

feat: Add peer comparison feature, live daily stats, and fix global rank & history fetching bugs#121

Open
Vachhani-Tapan wants to merge 3 commits into
codepvg:mainfrom
Vachhani-Tapan:main
Open

feat: Add peer comparison feature, live daily stats, and fix global rank & history fetching bugs#121
Vachhani-Tapan wants to merge 3 commits into
codepvg:mainfrom
Vachhani-Tapan:main

Conversation

@Vachhani-Tapan
Copy link
Copy Markdown

Description

This PR introduces a robust side-by-side Peer Comparison feature to the LeetCode leaderboard, allowing users to compare the performance, difficulty breakdown, and progress history of up to 3 peers. It also resolves data fetching compatibility issues, local development port conflicts, and repository sync-gap edge cases.

Linked Issue

Fixes #103

Changes Made

  • Compare Mode & Selection UI: Added an explicit Compare Mode toggle ($ compare_mode --enable/--disable) next to the search bar to keep the main view clean. Added checkboxes to leaderboard rows and mobile cards, along with a floating action bar showing active selections and a Reset button to exit compare mode.
  • Auto-Clear on Tab Switch: Integrated state clearance to automatically reset selected compared users when switching tabs (overall, weekly, monthly, daily) to avoid data inconsistency.
  • Dynamic Headings: Configured headers in the modal to display the active tab's context (e.g. metrics_summary (weekly)).
  • Chart.js Enhancements: Implemented progressive progress line charts using baseline subtraction relative to the start of the weekly/monthly window rather than absolute totals.
  • Daily Leaderboard Fallback: Created live stats cards for the daily view context pulling live profile statistics directly from the LeetCode API, falling back to offline records if API limits are hit.
  • History Fetching Fixes: Fixed a bug where dates between the local machine's current date and the latest synced date in the repository caused history queries to terminate early. Scans now bridge the gap and only stop once consecutive missing thresholds are met on active ranges.
  • Local Dev Port Conflict Resolution: Configured the frontend fetches to dynamically detect if the site is running locally on another port (e.g. VS Code Live Server at port 5500) and redirect /api/student/:username queries to port 3000 where the Express server runs.

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.

@Vachhani-Tapan
Copy link
Copy Markdown
Author

@jagdish-15 Review this Pull request asap because the next issue work is also done so that after this pr i can create a new pr for that issue #108

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.

feat: Implement a side-by-side user comparison tool for the leaderboard

1 participant