Skip to content

feat: implement custom leaderboard timeframes - #3108

Open
KrutagyaKaneria wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
KrutagyaKaneria:feat/issue-3045-custom-leaderboard-timeframes
Open

KrutagyaKaneria wants to merge 5 commits into
Priyanshu-byte-coder:mainfrom
KrutagyaKaneria:feat/issue-3045-custom-leaderboard-timeframes

Conversation

@KrutagyaKaneria

Copy link
Copy Markdown
Contributor

📌 Summary

This PR introduces support for custom leaderboard timeframes, allowing users to view rankings based on recent activity instead of only cumulative contributions.

The leaderboard now supports:

  • 📅 Weekly (last 7 days)
  • 📆 Monthly (last 30 days)
  • 🏆 All-Time

This improves leaderboard competitiveness, highlights recently active contributors, and increases community engagement.

Closes #3045


🚀 Changes Made

Backend

  • Added timeframe query parameter support to the leaderboard API.
  • Added validation for supported values:
    • weekly
    • monthly
    • all_time
  • Implemented timeframe-based aggregation logic.
  • Extended leaderboard caching to maintain separate cache entries for each timeframe.
  • Updated leaderboard rebuild logic to refresh all timeframe caches independently.

Frontend

  • Added a segmented timeframe selector:
    • Weekly
    • Monthly
    • All-Time
  • Connected UI to the updated leaderboard API.
  • Added loading states while switching between timeframes.
  • Preserved the existing leaderboard layout and responsiveness.

Performance

  • Reused existing cache infrastructure.
  • Avoided duplicate aggregation logic.
  • Kept database queries optimized.
  • Maintained backward compatibility with the existing leaderboard implementation.

✅ Testing

Verified the following:

  • Weekly leaderboard
  • Monthly leaderboard
  • All-Time leaderboard
  • Invalid timeframe returns 400 Bad Request
  • Cache entries remain isolated per timeframe
  • Leaderboard updates correctly when switching tabs
  • Existing functionality remains unaffected

🛠️ Quality Checks

  • pnpm run lint
  • pnpm run type-check
  • pnpm run test
  • pnpm run build

Close #3045

…PI integration

- Implemented LeaderboardBrowser component to display leaderboard data with selectable timeframes (weekly, monthly, all-time).
- Added functionality to sync selected timeframe with URL parameters.
- Created tests for LeaderboardBrowser to ensure correct API fetching and loading states.
- Introduced validation for unsupported timeframes in the leaderboard API route.
- Added unit tests for leaderboard timeframe helpers, including normalization and aggregation of leaderboard data.
@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:bug GSSoC type bonus: bug fix type:feature GSSoC type bonus: new feature type:testing GSSoC type bonus: tests (+10 pts) type:design GSSoC type bonus: UI/design (+10 pts) type:performance GSSoC type bonus: performance (+15 pts) labels Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@KrutagyaKaneria

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder can you review my PR

@KrutagyaKaneria

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder can you review this ??

@KrutagyaKaneria

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder can you review this ??

@Priyanshu-byte-coder

Copy link
Copy Markdown
Owner

Custom leaderboard timeframes is a nice feature, but the whole CI suite is failing here (Type check, Lint, Build, Test coverage, smoke + visual). Also the star-required gate is red — please star the repo so that check clears. Get the build green locally first (pnpm type-check && pnpm lint && pnpm build), then I'll take a look.

@KrutagyaKaneria

Copy link
Copy Markdown
Contributor Author

@Priyanshu-byte-coder can you check it now ?

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

This PR has been inactive for 21 days. If it is still in progress, please leave an update — otherwise it will be closed in 7 days.

@github-actions github-actions Bot added the stale Inactive for 21+ days label Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution stale Inactive for 21+ days type:bug GSSoC type bonus: bug fix type:design GSSoC type bonus: UI/design (+10 pts) type:feature GSSoC type bonus: new feature type:performance GSSoC type bonus: performance (+15 pts) type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] : Custom Leaderboard Timeframes

2 participants