fix: resolve HOT_STREAK badge flickering by excluding today's incomplete data#347
fix: resolve HOT_STREAK badge flickering by excluding today's incomplete data#347Yashaswini-K-P wants to merge 3 commits into
Conversation
|
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
left a comment
There was a problem hiding this comment.
I noticed one issue with the current approach.
By using history.slice(-9, -1), today's snapshot is excluded entirely. This means that if a user completes their 7th consecutive day today, today's progress won't be considered and the badge won't be awarded until tomorrow's snapshot is generated.
I'd prefer an approach that still includes today's snapshot while ensuring an incomplete current day doesn't incorrectly break an existing streak. That handles both edge cases correctly.
Description
This PR fixes an issue where the
HOT_STREAKbadge would prematurely disappear or flicker on the current calendar day. Previously, the streak calculation included today's incomplete data in its evaluation, causing the badge to be withheld until a problem was solved. By adjusting the history slice to look at the last 8 days excluding the current incomplete day, the badge now remains correctly visible throughout the day for users with an active streak.Linked Issue
Fixes #269
Changes Made
loadBadgesfunction logic.historyslice window from(-8)to(-9, -1)to exclude today's incomplete data from theHOT_STREAKcalculation.Type of Change
Testing
Checklist
npx prettier --write .before submittingfeature/*branch, not themainbranchScreenshots / Screen Recording
N/A