feat: add badge tracking to leaderboard sync and user api endpoint#214
Open
Yashaswini-K-P wants to merge 2 commits into
Open
feat: add badge tracking to leaderboard sync and user api endpoint#214Yashaswini-K-P wants to merge 2 commits into
Yashaswini-K-P wants to merge 2 commits into
Conversation
Contributor
|
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. Formatting and Branching
|
jagdish-15
requested changes
Jun 21, 2026
Comment on lines
+96
to
+97
| if (history.length >= 7) { | ||
| const recentHistory = history.slice(-7); |
Collaborator
There was a problem hiding this comment.
Suggested change
| if (history.length >= 7) { | |
| const recentHistory = history.slice(-7); | |
| if (history.length >= 8) { | |
| const recentHistory = history.slice(-8); |
We'd actually need 8 days of data here, similar to how we'd need data from yesterday to check if the user has solved a problem today
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.
Description
This PR introduces an automated student badge tracking and calculation engine (
SPEEDRUN,HOT_STREAK,UP_LINK) into the daily leaderboard synchronization cycle. It updates the user info API utility to cleanly parse and serve these newly generated badge mappings over the network to the frontend dashboard.Linked Issue
Fixes #108
scripts/sync-leaderboard.js: Built synchronous badge assignment steps, daily streak threshold algorithms, ranking delta trackers, and implemented safeatomicWritefile swaps to protectbadges.jsonagainst file corruption.scripts/fetch-user-info.js: Updated the pipeline to requestbadges.jsonindependently via separate, non-blockingtry/catchHTTP blocks to dynamically deliver student badge matrices to the client interface.Type of Change
Testing
Checklist
npx prettier --write .before submittingfeature/*branch, not themainbranchScreenshots / Screen Recording