UC-STU-004: Progress & Streak Tracking
1. Metadata
| Property | Value |
|---|---|
| ID | UC-STU-004 |
| Actor | Student |
| Trigger | Student views the Progress tab or logs an activity |
| Pre-conditions | Student has at least one logged activity |
| Post-conditions | Streak count and progress history are updated |
| Priority | P1 |
2. Description
Progress & Streak Tracking rewards consistent engagement by showing students their activity history, current streak, and cumulative achievements. Streaks are designed as a lightweight gamification lever — no leaderboards or peer pressure, just personal momentum.
3. Progress Metrics
| Metric | Description |
|---|---|
| Current Streak | Consecutive days with at least one meaningful activity (video or health log) |
| Weekly Summary | Bar chart of daily Nutrition Score for the past 7 days |
| Module Completion % | Percentage of assigned curriculum completed |
| Milestone Badges | Unlocked at 7-day, 30-day streaks and module completions |
4. Success Scenario
- Student opens the Progress tab — sees current streak (e.g., "Day 5") and weekly chart.
- Student completes a video lesson today — streak updates to Day 6.
- At Day 7, system unlocks the "Week Warrior" badge and shows a celebratory prompt.
- Admin can view aggregate module completion rates per school (linked to ADM-102).
5. Acceptance Criteria
- [ ] Streak must reset only if the student has zero activity for a full calendar day.
- [ ] Weekly chart must reflect the student's actual Nutrition Score, not just login presence.
- [ ] Badges must be visible in the student profile and persist indefinitely once earned.
- [ ] Progress data must be accessible offline (cached locally).
- [ ] Admin view must show school-level aggregate completion (not individual PII).
6. Logic Flow
graph TD
A[Activity Completed] --> B[Fetch last active day from DB]
B --> C{Was yesterday active?}
C -->|Yes| D[Increment streak counter]
C -->|No| E[Reset streak to 1]
D --> F{Milestone reached?}
E --> F
F -->|Yes| G[Unlock badge + show prompt]
F -->|No| H[Update streak display only]
G --> I[Persist badge to student profile]
H --> I