|
88 | 88 | from lms.djangoapps.instructor import enrollment, permissions |
89 | 89 | from lms.djangoapps.instructor.access import ( |
90 | 90 | FORUM_ROLES, |
| 91 | + INSTRUCTOR_DASHBOARD_ROLE_SORT_ORDER, |
91 | 92 | ROLE_DISPLAY_NAMES, |
92 | 93 | ROLES, |
93 | 94 | allow_access, |
@@ -3080,11 +3081,11 @@ class CourseTeamRolesView(DeveloperErrorViewMixin, APIView): |
3080 | 3081 | { |
3081 | 3082 | "course_id": "course-v1:edX+DemoX+Demo_Course", |
3082 | 3083 | "results": [ |
3083 | | - {"role": "beta", "display_name": "Beta Tester"}, |
3084 | | - {"role": "data_researcher", "display_name": "Data Researcher"}, |
3085 | | - {"role": "instructor", "display_name": "Admin"}, |
| 3084 | + {"role": "staff", "display_name": "Staff"}, |
3086 | 3085 | {"role": "limited_staff", "display_name": "Limited Staff"}, |
3087 | | - {"role": "staff", "display_name": "Staff"} |
| 3086 | + {"role": "instructor", "display_name": "Admin"}, |
| 3087 | + {"role": "beta", "display_name": "Beta Tester"}, |
| 3088 | + {"role": "data_researcher", "display_name": "Data Researcher"} |
3088 | 3089 | ] |
3089 | 3090 | } |
3090 | 3091 |
|
@@ -3112,15 +3113,22 @@ def get(self, request, course_id): |
3112 | 3113 | if editable and not has_access(request.user, 'instructor', course): |
3113 | 3114 | roles = set(FORUM_ROLES) |
3114 | 3115 |
|
| 3116 | + role_order = {role: i for i, role in enumerate(INSTRUCTOR_DASHBOARD_ROLE_SORT_ORDER)} |
| 3117 | + |
3115 | 3118 | results = [ |
3116 | 3119 | {'role': rolename, 'display_name': str(ROLE_DISPLAY_NAMES[rolename])} |
3117 | | - for rolename in sorted(roles) |
| 3120 | + for rolename in sorted( |
| 3121 | + roles, key=lambda r: role_order.get(r, len(INSTRUCTOR_DASHBOARD_ROLE_SORT_ORDER)) |
| 3122 | + ) |
3118 | 3123 | ] |
3119 | 3124 |
|
3120 | | - return Response({ |
3121 | | - 'course_id': str(course_key), |
3122 | | - 'results': results, |
3123 | | - }, status=status.HTTP_200_OK) |
| 3125 | + return Response( |
| 3126 | + { |
| 3127 | + 'course_id': str(course_key), |
| 3128 | + 'results': results, |
| 3129 | + }, |
| 3130 | + status=status.HTTP_200_OK |
| 3131 | + ) |
3124 | 3132 |
|
3125 | 3133 |
|
3126 | 3134 | @method_decorator(cache_control(no_cache=True, no_store=True, must_revalidate=True), name='dispatch') |
|
0 commit comments