Skip to content

bug: HOT_STREAK badge is withheld/dropped due to incomplete data tracking for the current day #269

Description

@Yashaswini-K-P

Description

The backend function checkHotStreak evaluates the HOT_STREAK badge using an active snapshot array slice (history.slice(-8)) that includes today's incomplete dataset. Because it requires strict daily increment comparison against the previous day (todayTotals - yesterdayTotals < 1), it forces a user's streak to drop or remain invisible for the majority of the day until they solve an additional problem on that specific calendar day.

The Problem

If a user solves a problem every single day for 7 days straight, their streak is technically valid. However, when the backend calculation runs at any point during "today":

  1. todayTotals will equal yesterdayTotals because the user hasn't completed/logged a new problem yet on this current calendar day (e.g., they plan to solve it at 9:00 PM).
  2. The condition if (todayTotals - yesterdayTotals < 1) evaluates to true.
  3. The loop triggers consecutiveDaysMet = false and breaks, stripping away or withholding their earned badge.

This leaves users with a tiny window of time to actually "feel" or see their badge. For example, if a user finishes their daily problem at 11:00 PM, they will only have the badge visible on their profile for exactly 1 hour before midnight resets the snapshot and breaks the conditional math again.

Proposed Solution

Modify the backend tracking logic to look at the last 7 fully completed days (ignoring today's live/incomplete snapshot), or adjust the math parameters to allow a grace window for the current calendar day's total so users aren't penalized for not completing a problem first thing in the morning.

would like to work on this !!!

Metadata

Metadata

Labels

BackendTask mainly involving backendlevel:intermediateIndicates the difficultytype:bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions