Skip to content

Conversation

@Duy-Nguyen1104
Copy link

@Duy-Nguyen1104 Duy-Nguyen1104 commented Apr 1, 2025

Description

Added a fallback mechanism for course maps, allowing users without personal course maps to see a template/default course map. When a user requests their course map but doesn't have one configured, the system will automatically return the template course map (defined with userId=null)
Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Tests have been added that cover the following scenarios:

  1. Template fallback: When a user without a course map requests their course map, they receive the template course map
  2. Personal map priority: When a user with their own course map makes a request, their personal map is returned (not the template)
  3. Course map unit structure: Template course maps contain the correct number of units in each year and teaching period
  4. Course map unit details: Units in template course maps have the correct data (unitId, yearSlot, teachingPeriodSlot, and unitSlot)

image

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if appropriate
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have created or extended unit tests to address my new additions
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

@martindolores martindolores left a comment

Choose a reason for hiding this comment

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

I was able to pull this down and test using curl. I can confirm when inputting a user id that doesn't directly have a course map, it will return a course map that has no associated user id to it. Integration tests are also passing :)

I do have a quick question though!

Comment on lines 19 to 21
if course_map.nil?
course_map = CourseMap.find_by(userId: nil)
end

Choose a reason for hiding this comment

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

What happens if there is multiple course_maps records with no userId associated to it? How do we know which default course map to grab?

Copy link
Author

Choose a reason for hiding this comment

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

I have asked Nebula on this matter. He told me that there would only be 1 default course map template for all users regardless of their course/major, so in all cases that would be the one selected for users who do not have a course map associated with their userId.

Copy link

@samindiii samindiii left a comment

Choose a reason for hiding this comment

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

Hello! Great job on your work :) I've gone through the code and suggested some changes! Feel free to reach out to me if you have any questions. Please remember to tag me or message me when you've made changes! Thanks :)

Copy link

@martindolores martindolores left a comment

Choose a reason for hiding this comment

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

Great work 🤘

@aNebula
Copy link

aNebula commented Jun 12, 2025

LGTM.
@Duy-Nguyen1104 please open an upstream PR against new/course-flow branch in doubtfire-lms/doubtfire-api

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.

4 participants