The HOT_STREAK badge in frontend/js/user/badges.js is currently determined by manually iterating through the user.history array and calculating consecutive active days on the client side. This duplicates logic that is now handled by the backend and introduces unnecessary complexity and edge-case handling.
Proposed Solution
With the backend now exposing the user's streak information (introduced in PR #349), the frontend should use it directly instead of recalculating the streak from the history array.
The existing history traversal logic can be replaced with a simple check:
if (data.streak && data.streak.current >= 7) {
earnedSet.add("HOT_STREAK");
}
Tasks
The
HOT_STREAKbadge infrontend/js/user/badges.jsis currently determined by manually iterating through theuser.historyarray and calculating consecutive active days on the client side. This duplicates logic that is now handled by the backend and introduces unnecessary complexity and edge-case handling.Proposed Solution
With the backend now exposing the user's streak information (introduced in PR #349), the frontend should use it directly instead of recalculating the streak from the history array.
The existing history traversal logic can be replaced with a simple check:
Tasks
frontend/js/user/badges.js.data.streak.current >= 7.