Skip to content

Commit

Permalink
Merge pull request #117 from Pearson-Advance/vue/PADV-1025
Browse files Browse the repository at this point in the history
PADV 1025 - Notes tab does not display notes for ccx
  • Loading branch information
alexjmpb authored Mar 4, 2024
2 parents 220ee91 + ffd3b4a commit 45d5fa7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lms/djangoapps/edxnotes/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from xblock.exceptions import NoSuchServiceError

from common.djangoapps.edxmako.shortcuts import render_to_string
from common.djangoapps.student.auth import is_ccx_course


def edxnotes(cls):
Expand All @@ -34,6 +35,9 @@ def get_html(self, *args, **kwargs):
return original_get_html(self, *args, **kwargs)

is_studio = getattr(self.runtime, "is_author_mode", False)
# Right now, if the course is a CCX, the course.id value contains a course id with branches.
# This causes discrepancy in the notes data, since the course_id for the note is being saved using
# branches and meanwhile the notes tab searches for the course without branches.
course = getattr(self, 'descriptor', self).runtime.modulestore.get_course(self.scope_ids.usage_id.context_key)

# Must be disabled when:
Expand All @@ -58,7 +62,8 @@ def get_html(self, *args, **kwargs):
"params": {
# Use camelCase to name keys.
"usageId": self.scope_ids.usage_id,
"courseId": course.id,
# We need to change the value when the course is a CCX because of the issue commented above.
"courseId": course.id if not is_ccx_course(course.id) else course.id.for_branch(branch=None),
"token": get_edxnotes_id_token(user),
"tokenUrl": get_token_url(course.id),
"endpoint": get_public_endpoint(),
Expand Down

0 comments on commit 45d5fa7

Please sign in to comment.