fix: sort Advanced components alphabetically by display name (#36767)

adding sorting of Advanced components in the studio by display name
This commit is contained in:
Ivan Niedielnitsev
2025-07-21 19:28:54 +03:00
committed by GitHub
parent 36327ff27c
commit 7e8d8888f2
2 changed files with 7 additions and 2 deletions

View File

@@ -494,6 +494,11 @@ def get_component_templates(courselike, library=False): # lint-amnesty, pylint:
course_advanced_keys
)
if advanced_component_templates['templates']:
# Advanced component templates should be sorted alphabetically by display name.
advanced_component_templates['templates'] = sorted(
advanced_component_templates['templates'],
key=lambda x: x.get('display_name')
)
component_templates.append(advanced_component_templates)
return component_templates

View File

@@ -2909,7 +2909,7 @@ class TestComponentTemplates(CourseTestCase):
self.templates = get_component_templates(self.course)
self.default_advanced_modules_titles = [
self.default_advanced_modules_titles = sorted([
"Google Calendar",
"Google Document",
"LTI Consumer",
@@ -2917,7 +2917,7 @@ class TestComponentTemplates(CourseTestCase):
"Content Experiment",
"Survey",
"Word cloud",
]
])
def get_templates_of_type(self, template_type):
"""