Skip to content

Conversation

@jeromehardaway
Copy link
Contributor

Progress API Implementation:

  • Created /api/lms/progress endpoint with GET and POST methods
  • GET: Fetch user progress filtered by lessonId, moduleId, or courseId
  • POST: Mark lessons complete/incomplete and track time spent
  • Automatic enrollment lastActivity updates on progress changes
  • Enrollment verification before allowing progress tracking

Lesson Page Updates (web-development/[moduleId]/[lessonId].tsx):

  • Replaced localStorage with real API calls for progress tracking
  • Fetch lesson completion status on page load
  • Fetch module progress for real-time sidebar stats
  • Mark as Complete button now saves to database
  • Loading states with spinner during save
  • Dynamic progress bars based on actual completion data
  • Auto-increment module progress counter on completion

Database Integration:

  • Leverages existing Progress model (userId, lessonId, completed, timeSpent)
  • Unique constraint ensures one progress record per user per lesson
  • Tracks startedAt and completedAt timestamps
  • Updates course enrollment lastActivity on any progress change

Student Benefits:

  • Progress persists across sessions and devices
  • Real-time progress tracking as lessons are completed
  • Accurate module completion percentages in sidebar
  • Foundation for course completion calculations
  • Enrollment activity tracking for engagement metrics

Progress API Implementation:
- Created /api/lms/progress endpoint with GET and POST methods
- GET: Fetch user progress filtered by lessonId, moduleId, or courseId
- POST: Mark lessons complete/incomplete and track time spent
- Automatic enrollment lastActivity updates on progress changes
- Enrollment verification before allowing progress tracking

Lesson Page Updates (web-development/[moduleId]/[lessonId].tsx):
- Replaced localStorage with real API calls for progress tracking
- Fetch lesson completion status on page load
- Fetch module progress for real-time sidebar stats
- Mark as Complete button now saves to database
- Loading states with spinner during save
- Dynamic progress bars based on actual completion data
- Auto-increment module progress counter on completion

Database Integration:
- Leverages existing Progress model (userId, lessonId, completed, timeSpent)
- Unique constraint ensures one progress record per user per lesson
- Tracks startedAt and completedAt timestamps
- Updates course enrollment lastActivity on any progress change

Student Benefits:
- Progress persists across sessions and devices
- Real-time progress tracking as lessons are completed
- Accurate module completion percentages in sidebar
- Foundation for course completion calculations
- Enrollment activity tracking for engagement metrics
@jeromehardaway jeromehardaway requested a review from Copilot January 1, 2026 03:52
@jeromehardaway jeromehardaway self-assigned this Jan 1, 2026
@vercel
Copy link
Contributor

vercel bot commented Jan 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
vets-who-code-app Ready Ready Preview, Comment Jan 1, 2026 3:54am

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a comprehensive lesson tracking system with real-time progress updates, replacing client-side localStorage with persistent database storage. The implementation introduces a new /api/lms/progress endpoint for fetching and updating lesson completion status, integrated with the lesson page UI to display dynamic progress metrics.

Key Changes:

  • Created a new progress API endpoint supporting GET (fetch progress by lesson/module/course) and POST (mark lessons complete/incomplete with time tracking)
  • Updated lesson page to fetch real-time progress data on mount and dynamically update UI elements based on actual completion status
  • Integrated enrollment verification and automatic lastActivity updates on progress changes

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/pages/api/lms/progress/index.ts New API endpoint implementing GET/POST methods for progress tracking with enrollment verification and database integration
src/pages/courses/web-development/[moduleId]/[lessonId].tsx Replaced localStorage with API calls, added loading states, and implemented dynamic progress bars with real-time updates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +191 to +194
setModuleProgress((prev) => ({
...prev,
completed: prev.completed + 1,
}));
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The progress counter increments even if the lesson was already completed, causing incorrect progress counts. Check if completed is currently false before incrementing, or refetch the module progress from the API to ensure accuracy.

Copilot uses AI. Check for mistakes.
const { courseId, moduleId, lessonId } = req.query;

// Build where clause for filtering
const where: any = { userId };
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any type defeats TypeScript's type safety. Consider using Prisma.ProgressWhereInput or defining a proper interface for the where clause to maintain type safety.

Copilot uses AI. Check for mistakes.

if (existingProgress) {
// Update existing progress
const updateData: any = {};
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using any type bypasses TypeScript's type checking. Use Prisma.ProgressUpdateInput or a properly typed object to ensure type safety for update operations.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

github-actions bot commented Jan 1, 2026

🔍 Code Quality Score Breakdown:

  • 📖 Readability: 2/10
  • 📈 Scalability: 5/10
  • 🚀 Performance: 5/10
  • 🛠️ Maintainability: 8/10
  • ✅ Overall Score: 5.0/10

💡 Recommendations:

  • 🧹 Reduce ESLint warnings to improve readability.
  • 📦 Break up complex functions or components.
  • ⚙️ Consider splitting large files or lazy-loading.
  • 🔁 Refactor to increase your overall score next cycle.

@jeromehardaway jeromehardaway merged commit c53ddb6 into master Jan 1, 2026
5 checks passed
@jeromehardaway jeromehardaway deleted the feat/phase-2-lesson-tracking branch January 1, 2026 03:57
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.

2 participants