Skip to content
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

PADV 1025 - Notes tab does not display notes for ccx #117

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
alexjmpb marked this conversation as resolved.
Show resolved Hide resolved

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
Loading