Skip to content

feat(leaderboard): add live Codeforces and CodeChef sync, Redis caching and cooldown API - #227

Open
Shubham15986 wants to merge 2 commits into
RECursion-NITD:testing2from
Shubham15986:feat/college-cp-leaderboard
Open

feat(leaderboard): add live Codeforces and CodeChef sync, Redis caching and cooldown API#227
Shubham15986 wants to merge 2 commits into
RECursion-NITD:testing2from
Shubham15986:feat/college-cp-leaderboard

Conversation

@Shubham15986

@Shubham15986 Shubham15986 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR implements the college competitive programming leaderboard backend for NIT Durgapur, pulling live standings from Codeforces and CodeChef with Redis caching.

Resolves #163

Key Changes

  • Live Scrapers:
    • Codeforces organization sync targeting NIT Durgapur (https://codeforces.com/ratings/organization/785) capturing handles, ratings, rank titles, contest counts, and active status.
    • CodeChef institution sync with CSRF and pagination support capturing ratings, stars, global ranks, and active status.
  • Data Models & Normalization:
    • Symmetrical fields for both platforms with is_active platform flags.
    • Symmetrical ranking calculations and dynamic filtering (active_only / show_inactive).
  • Performance & Redis Caching:
    • Redis cache integration with 300s TTL per filter configuration (~4.7ms response times).
    • Dedicated refresh endpoint (POST /api/leaderboard/refresh/) with a strict 5-minute cooldown timer to prevent rate limits.
    • Cooldown query endpoint (GET /api/leaderboard/cooldown/).
  • Management Command:
    • python manage.py sync_leaderboard for scheduled or manual sync of college standings.

Endpoints Added

  • GET /api/leaderboard/?platform=codeforces|codechef&search=...&active_only=true|false
  • POST /api/leaderboard/refresh/
  • GET /api/leaderboard/cooldown/

Deployment Notes

After merging, run:

python manage.py migrate
python manage.py sync_leaderboard

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.

1 participant