Skip to content

refactor: use backend streak data for HOT_STREAK badge evaluation - #494

Open
Yashaswini-K-P wants to merge 1 commit into
codepvg:mainfrom
Yashaswini-K-P:feature/hot-streak-refactor
Open

refactor: use backend streak data for HOT_STREAK badge evaluation#494
Yashaswini-K-P wants to merge 1 commit into
codepvg:mainfrom
Yashaswini-K-P:feature/hot-streak-refactor

Conversation

@Yashaswini-K-P

Copy link
Copy Markdown
Contributor

Description

Refactored the HOT_STREAK badge evaluation logic in frontend/js/user/badges.js to utilize the backend's precalculated streak data (data.streak.current) instead of manually traversing and recalculating streaks on the client-side history array, reducing code duplication and edge-case handling.

Linked Issue

Fixes #360

Changes Made

  • Removed the manual client-side history iteration loop used for calculating HOT_STREAK.
  • Implemented a clean check if (data.streak && data.streak.current >= 7) to award the HOT_STREAK badge.
  • Cleaned up trailing array comma syntax in ALL_BADGES.

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 by running npx prettier --write . before submitting
  • I am submitting my PR from a dedicated feature/* branch, not the main branch
  • 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

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
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

  • Please confirm you have formatted your code locally using npx prettier --write . before requesting a review.
  • Ensure this PR is made from a feature/* branch and not main.

Note: This project is currently maintained by a solo maintainer, so reviews and responses may sometimes take a little time. Thanks for your patience.

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.

Use Backend Streak Data for HOT_STREAK Badge

1 participant