diff --git a/lms/djangoapps/course_home_api/outline/serializers.py b/lms/djangoapps/course_home_api/outline/serializers.py index 0d0bf4632cfb..28b98211a968 100644 --- a/lms/djangoapps/course_home_api/outline/serializers.py +++ b/lms/djangoapps/course_home_api/outline/serializers.py @@ -36,6 +36,9 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring if graded and scored: icon = 'fa-pencil-square-o' + if block_type == 'vertical': + icon = self.get_vertical_icon_class(block) + if 'special_exam_info' in block: description = block['special_exam_info'].get('short_description') icon = block['special_exam_info'].get('suggested_icon', 'fa-pencil-square-o') @@ -62,6 +65,17 @@ def get_blocks(self, block): # pylint: disable=missing-function-docstring serialized.update(self.get_blocks(child)) return serialized + @staticmethod + def get_vertical_icon_class(block): + children = block.get('children', []) + child_classes = {child.get('type') for child in children} + new_class = 'other' + icon_call_priority = ['video', 'problem'] + for higher_class in icon_call_priority: + if higher_class in child_classes: + new_class = higher_class + return new_class + class CourseGoalsSerializer(serializers.Serializer): """