Comprehensive progress tracking and gamification service for the WayrApp language learning platform.
This service manages all aspects of user progress including experience points calculation, lesson completion
tracking, streak management, and offline synchronization. It serves as the central business logic layer
for the progress tracking system, handling complex scenarios like performance-based experience multipliers,
conflict resolution during offline sync, and gamification features such as lives and daily streaks.
The service integrates with the ProgressRepository for data persistence and provides comprehensive
progress analytics for both users and administrators. It automatically initializes user progress
when needed and maintains data consistency through transactional operations and proper error handling.
Key features include intelligent experience point calculation based on lesson difficulty and user
performance, robust offline progress synchronization with duplicate detection, streak calculation
based on daily activity patterns, and comprehensive progress summaries for dashboard displays.
Author
Exequiel Trujillo
Since
1.0.0
Example
// Initialize service with dependencies constprogressRepository = newProgressRepository(prisma); constprogressService = newProgressService(progressRepository, prisma);
// Complete a lesson and update progress constresult = awaitprogressService.completeLesson('user-123', { lesson_id:'lesson-456', score:85, time_spent_seconds:120 });
Comprehensive progress tracking and gamification service for the WayrApp language learning platform.
This service manages all aspects of user progress including experience points calculation, lesson completion tracking, streak management, and offline synchronization. It serves as the central business logic layer for the progress tracking system, handling complex scenarios like performance-based experience multipliers, conflict resolution during offline sync, and gamification features such as lives and daily streaks.
The service integrates with the ProgressRepository for data persistence and provides comprehensive progress analytics for both users and administrators. It automatically initializes user progress when needed and maintains data consistency through transactional operations and proper error handling.
Key features include intelligent experience point calculation based on lesson difficulty and user performance, robust offline progress synchronization with duplicate detection, streak calculation based on daily activity patterns, and comprehensive progress summaries for dashboard displays.
Author
Exequiel Trujillo
Since
1.0.0
Example