Skip to content

feat: implement incremental streak tracking and backfill initialization#349

Open
Yashaswini-K-P wants to merge 2 commits into
codepvg:mainfrom
Yashaswini-K-P:feat/streak-backend-logic
Open

feat: implement incremental streak tracking and backfill initialization#349
Yashaswini-K-P wants to merge 2 commits into
codepvg:mainfrom
Yashaswini-K-P:feat/streak-backend-logic

Conversation

@Yashaswini-K-P

@Yashaswini-K-P Yashaswini-K-P commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description

Implemented incremental streak tracking to enhance user engagement. This PR introduces a backend utility to calculate streak history and updates the sync process to use constant-time (O(1)) logic, avoiding expensive full-history scans during every 15-minute sync.

Linked Issue

Related to #51

Changes Made

  • Added scripts/backfill-streaks.js to calculate and initialize currentStreak, longestStreak, and streakLastUpdated for existing users.
  • Updated sync-leaderboard.js to include incremental streak logic (Step A: Check for broken streak, Step B & C: Detect activity and update streak).
  • Added logic to persist streak metadata in user-specific JSON files.

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

N/A

@github-actions

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.

1 participant