Skip to content

Implement API for Learner Progress #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ji-mmyliu
Copy link
Collaborator

@ji-mmyliu ji-mmyliu commented Apr 10, 2025

Notion ticket link

Learner Course Progress Tracking

Implementation description

  • Added an activitiesCompleted field for learners that specifies the object IDs of course pages that a learner has viewed (or completed if it's an activity)
    • Added API endpoints for marking a page as completed and also querying the learner's progress (including a full list of the modules that they have completed)
  • Added a nextPage field to track the next page that the learner should be directed to when they return to the site
    • Added an API endpoint for marking the most recently viewed page. This will calculate and update the nextPage field.

Steps to test

  1. Try playing around with the API endpoints to ensure their functionality. Namely: PUT /users/learner/markActivityCompleted, GET /users/learner/progress, and PUT /users/learner/viewedPage

What should reviewers focus on?

  • Functionality and structure of the code, including edge cases or foreseeable issues when implementing the frontend

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

Copy link

@Copilot 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.

Copilot reviewed 20 out of 21 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • backend/package.json: Language not supported
Comments suppressed due to low confidence (2)

backend/types/userTypes.ts:44

  • The 'activitiesCompleted' field in LearnerDTO uses string arrays, but the corresponding field in the user model uses ObjectId arrays. Consider aligning these types or clearly documenting the conversion to ensure consistency.
+  activitiesCompleted: Map<string, Map<string, string[]>>;

backend/services/implementations/courseModuleService.ts:66

  • The identifier 'Schema' is used in fetchPage without a corresponding import. Import 'Schema' from 'mongoose' (or reference mongoose.Schema) to avoid runtime errors.
  private static async fetchPage(page: Schema.Types.ObjectId): Promise<CoursePage> {

@ji-mmyliu ji-mmyliu force-pushed the jimmy-harishan/learner-progress branch from 137c89c to 3db7130 Compare April 10, 2025 03:26
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.

1 participant