Bug Description
Description
Streak milestone notifications are not being triggered after flashcard reviews or sheet-progress saves because recordActivity() now returns the property newlyUnlockedMilestones, while the affected controllers still read the old property name newlyUnlocked.
The affected files are:
backend/utils/streakTracker.js
backend/controllers/flashcardController.js
backend/controllers/userSheetProgressController.js
recordActivity() returns:
{ user, newlyUnlockedMilestones }
### Steps to Reproduce
```markdown
1. Log in to the application.
2. Use the application until the next streak milestone is reached.
3. Complete a flashcard review that records streak activity.
4. Observe the response/data returned from the flashcard review flow.
5. Check whether the newly unlocked streak milestone notification/toast appears.
6. Alternatively, save sheet progress while crossing a streak milestone.
7. Observe whether the streak milestone toast is displayed.
8. Compare the value passed as `newlyUnlockedAchievements` with the `newlyUnlockedMilestones` value returned by `recordActivity()`.
### Expected Behavior
When a user crosses a streak milestone while reviewing a flashcard or saving sheet progress, the newly unlocked milestone should be included in the response as `newlyUnlockedAchievements`.
The frontend should then receive the milestone information and display the corresponding streak milestone toast.
For example:
```js
{
newlyUnlockedAchievements: [...]
}
### Actual Behavior
When a streak milestone is reached through a flashcard review or sheet-progress save, the milestone data is not correctly propagated to the frontend.
`recordActivity()` returns `newlyUnlockedMilestones`, but the affected controllers still read the old `newlyUnlocked` property. As a result, `newlyUnlockedAchievements` is empty or undefined in the response.
The frontend therefore does not receive the newly unlocked milestone and no streak milestone toast is displayed.
This affects:
- Flashcard reviews
- Sheet-progress saves
- The retry path for sheet-progress saves
The session flow is not affected because `sessionController.js` uses the updated streak handling correctly.
### Severity
Medium
### Screenshots / Screen Recording
_No response_
### Browser
Chrome
### Operating System
Windows 11
### Additional Context
## Root Cause
`recordActivity()` was changed to return:
```js
{
user,
newlyUnlockedMilestones
}
Bug Description
Description
Streak milestone notifications are not being triggered after flashcard reviews or sheet-progress saves because
recordActivity()now returns the propertynewlyUnlockedMilestones, while the affected controllers still read the old property namenewlyUnlocked.The affected files are:
backend/utils/streakTracker.jsbackend/controllers/flashcardController.jsbackend/controllers/userSheetProgressController.jsrecordActivity()returns: