Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [AXIMST-584] add correct icon for vertical block #2513

Conversation

NiedielnitsevIvan
Copy link

AXIMST-584 [BE] Create endpoint providing Course structure for sidebar

Comment on lines +68 to +80
@staticmethod
def get_vertical_icon_class(block):
"""
Get the icon class for a vertical block based on its children.
"""
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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@staticmethod
def get_vertical_icon_class(block):
"""
Get the icon class for a vertical block based on its children.
"""
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
@staticmethod
def get_vertical_icon_class(block, icon_mapping=None):
"""
Returns the icon class for a vertical block based on its children.
Args:
block (object): xblock object
Returns:
str: The icon class name to be used, or 'other' if no match is found.
"""
if icon_mapping is None:
icon_mapping = {
'video': 'video',
'problem': 'problem',
}
for child in block.get('children', []):
if child.get('type') in icon_mapping:
return icon_mapping[child.get('type')]
return 'other'

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if this passes as a solution

@monteri monteri merged commit bb61ce2 into ts-develop Mar 13, 2024
43 checks passed
monteri pushed a commit that referenced this pull request Mar 13, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
ruzniaievdm pushed a commit that referenced this pull request Mar 28, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
ruzniaievdm pushed a commit that referenced this pull request Apr 4, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
monteri pushed a commit that referenced this pull request Apr 10, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
GlugovGrGlib pushed a commit that referenced this pull request Apr 12, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
monteri pushed a commit that referenced this pull request Apr 17, 2024
* fix: [AXIMST-584] add correct icon for vertical block

* style: [AXIMST-584] add missing docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants