Skip to content

Gamification: Streaks — record activity + current/longest in sidebar #80

Description

@ljm20088

Parent PRD

#41

What to build

Streaks, end-to-end. When a student completes at least one lesson in a UTC day, a streak activity is recorded; the sidebar shows the current streak and longest-ever streak with a flame icon (visible even at 0 days).

  • New streak_activities table (one row per user per UTC day). See PRD "Database Changes".
  • Add denormalized currentStreak and longestStreak integer columns to the users table (decided: store on users), updated on each lesson completion. See PRD "Further Notes".
  • Extend progressService.markLessonComplete to record streak activity (idempotent per UTC day — multiple completions in one day = one streak day) and recompute current/longest. Streak resets to 0 when a full UTC day passes with no completion. UTC-only, no grace/freeze. See PRD "Streak System", user stories 12-14.
  • Sidebar shows current streak + longest streak with a flame/streak icon; the section is always visible, even at 0 days (user story 9).

Acceptance criteria

  • streak_activities table + currentStreak/longestStreak columns added with migration (pnpm db:generate / pnpm db:migrate)
  • Completing a lesson records at most one streak activity per UTC day
  • Consecutive UTC days increase the current streak; a missed UTC day resets it to 0
  • Longest streak is tracked and never decreases
  • Sidebar shows current + longest streak with a flame icon, visible even at 0
  • Tests cover consecutive days, same-day dedup, and gap reset
  • pnpm test and typecheck pass

Blocked by

User stories addressed

  • User story 7
  • User story 8
  • User story 9
  • User story 12
  • User story 13
  • User story 14

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions