Skip to content

feat(gamification): add XP, streaks, and achievements engine#62

Open
nymulinfoinlet wants to merge 4 commits intomainfrom
feat/gamification
Open

feat(gamification): add XP, streaks, and achievements engine#62
nymulinfoinlet wants to merge 4 commits intomainfrom
feat/gamification

Conversation

@nymulinfoinlet
Copy link
Copy Markdown
Contributor

Summary

  • Adds a full gamification module (backend/src/modules/gamification/) with XP ledger, streak tracking, achievement conditions engine, and leaderboards
  • Creates DB migration (016_gamification.sql) with xp_ledger, user_gamification, achievement_definitions, and user_achievements tables, plus 10 seeded achievements
  • Integrates XP awards and study-day tracking into flashcard reviews (5 XP), quiz completions (20 XP + 50 bonus for perfect), exam completions (30 XP), teach-back sessions (30 XP), and knowledge-base uploads (15 XP)
  • Exposes three authenticated endpoints: GET /gamification/profile, GET /gamification/leaderboard, GET /gamification/achievements

Test plan

  • Run cd backend && npx tsc --noEmit -- 0 errors
  • Run migration against a test database and verify all 4 tables are created with seed data
  • Review a flashcard and verify XP appears in xp_ledger and user_gamification.total_xp increments
  • Complete a quiz with 100% score and verify both quiz_complete and quiz_perfect XP entries
  • Verify streak increments on consecutive days and resets after a gap
  • Verify achievements unlock when conditions are met and bonus XP is awarded
  • Hit GET /gamification/profile and verify all fields are returned
  • Hit GET /gamification/leaderboard?period=weekly&limit=10 and verify ranking
  • Hit GET /gamification/achievements and verify progress tracking

Closes #51

🤖 Generated with Claude Code

nymulinfoinlet and others added 4 commits April 12, 2026 17:02
Expand the quiz system from 4 to 8 question types to support deeper
assessments. New types include partial credit scoring (matching, ordering),
auto-graded code execution via code-sandbox service (coding), and
AI-evaluated long-form answers with rubric-based feedback (essay).

Closes #46

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Add a new import-export module that enables students to bring in their
existing flashcard collections and export study sets for use in other tools.

- AnkiImportService: parses .apkg files (ZIP + SQLite), extracts notes
  with field separator parsing, strips HTML/media references, creates
  flashcards via existing FlashcardsService.createBulk
- AnkiExportService: generates minimal .apkg files with proper Anki
  schema (col, notes, cards tables), Basic model template, and media stub
- CsvImportService: handles CSV/TSV with auto-detected delimiters,
  quoted field parsing, header detection (Quizlet compatible)
- CsvExportService: exports study set as CSV with front, back, tags columns
- ImportExportController: four endpoints mounted on study-sets/:id
  (POST import/anki, POST import/csv, GET export/anki, GET export/csv)

Dependencies: adm-zip, better-sqlite3 (+ @types)

Closes #47

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Implement LTI 1.3 (Learning Tools Interoperability) so Studyield can be
embedded as a learning tool inside Canvas, Moodle, Blackboard, and other
LMS platforms. Uses manual OAuth2 + JWT implementation for clean NestJS
integration instead of ltijs.

- OIDC login initiation and launch callback endpoints
- JWT verification against platform JWKS
- User mapping (find-or-create by email on LTI launch)
- Assignment and Grade Services (AGS) for posting scores back to the LMS
- Admin API for registering/listing/deleting LMS platforms
- JWKS endpoint for platforms to verify tool signatures
- Database migration for lti_platforms and lti_contexts tables
- Environment variables for LTI configuration

Closes #48

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Implement a full gamification system with XP tracking, study streaks,
achievement conditions, and leaderboards. Integrates with flashcard
reviews, quiz completions, exam attempts, teach-back sessions, and
knowledge-base uploads to award XP and track progress.

Closes #51

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gamification): XP system, streaks, achievements engine, and leveling

1 participant