Commit e6b3f8f8 by Awais Jibran

Studio Edge cannot load the Course Dashboard for CCX courses.

TNL-4484
parent 1feb4fdb
...@@ -412,12 +412,16 @@ def _accessible_courses_list_from_groups(request): ...@@ -412,12 +412,16 @@ def _accessible_courses_list_from_groups(request):
""" """
List all courses available to the logged in user by reversing access group names List all courses available to the logged in user by reversing access group names
""" """
def filter_ccx(course_access):
""" CCXs cannot be edited in Studio and should not be shown in this dashboard """
return not isinstance(course_access.course_id, CCXLocator)
courses_list = {} courses_list = {}
in_process_course_actions = [] in_process_course_actions = []
instructor_courses = UserBasedRole(request.user, CourseInstructorRole.ROLE).courses_with_role() instructor_courses = UserBasedRole(request.user, CourseInstructorRole.ROLE).courses_with_role()
staff_courses = UserBasedRole(request.user, CourseStaffRole.ROLE).courses_with_role() staff_courses = UserBasedRole(request.user, CourseStaffRole.ROLE).courses_with_role()
all_courses = instructor_courses | staff_courses all_courses = filter(filter_ccx, instructor_courses | staff_courses)
for course_access in all_courses: for course_access in all_courses:
course_key = course_access.course_id course_key = course_access.course_id
...@@ -440,9 +444,7 @@ def _accessible_courses_list_from_groups(request): ...@@ -440,9 +444,7 @@ def _accessible_courses_list_from_groups(request):
# If a user has access to a course that doesn't exist, don't do anything with that course # If a user has access to a course that doesn't exist, don't do anything with that course
pass pass
# Custom Courses for edX (CCX) is an edX feature for re-using course content. if course is not None and not isinstance(course, ErrorDescriptor):
# CCXs cannot be edited in Studio (aka cms) and should not be shown in this dashboard.
if course is not None and not isinstance(course, ErrorDescriptor) and not isinstance(course.id, CCXLocator):
# ignore deleted, errored or ccx courses # ignore deleted, errored or ccx courses
courses_list[course_key] = course courses_list[course_key] = course
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment