From 08808c0523a7d988748524d3254cce2e1f23934b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=86=D0=B2=D0=B0=D0=BD=20=D0=9D=D1=94=D0=B4=D1=94=D0=BB?= =?UTF-8?q?=D1=8C=D0=BD=D1=96=D1=86=D0=B5=D0=B2?= Date: Wed, 13 Mar 2024 10:26:41 +0200 Subject: [PATCH] fix: [AXIMST-584] add correct icon for vertical block --- .../course_home_api/outline/serializers.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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): """