feat: add gfg integration#10
Closed
Devx2107 wants to merge 1 commit into
Closed
Conversation
Owner
|
is the new platform really required? |
Contributor
Author
I think so its a nice little addition as quite a few begginers begin their journey from gfg . Also i think we can add atcoder as well. Instead of them getting a big sillhoute on the main page . it can be give space only when you open the profile and that too at the bottom of all of it. |
Owner
|
yes it's better to add these small platforms on profile page sorry for late reply :) |
Contributor
Author
hmm true , its okay happens no issues |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
# feat: add GeeksForGeeks platform integration
What
Adds GeeksForGeeks as a 5th platform, raising the maximum total score from 4000 to 5000.
Why
GFG is heavily used by NSUT students for placement prep — DSA practice, company-specific problem sets, and the GFG Institute Rank are all things students actively track. It was a visible gap in the leaderboard for anyone doing placement-focused practice alongside competitive programming.
Changes
New file —
backend/platforms/gfg.jsFull platform module following the existing registry contract:
fetchStats(username)— hits GFG's internal JSON API (auth.geeksforgeeks.org/user/{username}/practice/). No scraping — GFG returns structured JSON directly, making this more reliable than the existing CodeChef integration.validateUsername(username)— checks for a validuserHandlein the API responsecalculateScore(stats)— weighted solved score (Easy×1 + Med×3 + Hard×6, max 700) + GFG practice score bonus (max 300), capped at 1000. Same shape as the LeetCode formula.totalSolved,easySolved,mediumSolved,hardSolved,score,monthlyScore,instituteRank,streakbackend/platforms/index.jsrequire('./gfg')and registered it in theplatformsarraybackend/models/Student.jsgfgsubdocument (username + 8 stats fields +lastUpdated)scores.gfgandranks.gfgfieldsbackend/controllers/studentController.jsPLATFORM_KEYSfrom a hardcoded array togetAllPlatforms().map(p => p.key)so new platforms are automatically picked up without manual edits herebackend/cron/updateData.jsgfgtoPLATFORM_CONCURRENCY(4 workers) andPLATFORM_DELAY_MS(300ms)README.mdgfg.jsto the project structureNo new dependencies
axiosalready handles the JSON API calls. No scraping libraries needed.Testing
fetchStatsreturns correct solved counts and scorevalidateUsernamecorrectly returnsfalsefor non-existent usernames (404 from GFG API)Notes
fetchStatsreturnsnullgracefully and the cron skips that student's GFG data without affecting other platforms.instituteRankwill reflect the student's college rank if they've set their institute to NSUT on their GFG profile — useful signal for placement context.monthlyScoreis worth surfacing in a future PR as a "This Month" leaderboard column — left out of this PR to keep scope tight.