From cec560b3abeb855a0b1471725aa7d9c6fce8d1c6 Mon Sep 17 00:00:00 2001 From: connorhaugh <49422820+connorhaugh@users.noreply.github.com> Date: Mon, 12 Dec 2022 15:09:43 -0500 Subject: [PATCH] feat: one problem type for new problem editor (#31423) * feat: one problem type for new problem editor * fix: add comment, fix lint * fix: remove print statement * fix: lint fix --- cms/djangoapps/contentstore/views/component.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/component.py b/cms/djangoapps/contentstore/views/component.py index a9d0230d80cb..9b86350ed2c4 100644 --- a/cms/djangoapps/contentstore/views/component.py +++ b/cms/djangoapps/contentstore/views/component.py @@ -24,6 +24,7 @@ from common.djangoapps.student.auth import has_course_author_access from common.djangoapps.xblock_django.api import authorable_xblocks, disabled_xblocks from common.djangoapps.xblock_django.models import XBlockStudioConfigurationFlag +from cms.djangoapps.contentstore.toggles import use_new_problem_editor from openedx.core.lib.xblock_utils import get_aside_from_xblock, is_xblock_aside from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order @@ -353,9 +354,16 @@ def create_support_legend_dict(): ) ) + #If using new problem editor, we select problem type inside the editor + # because of this, we only show one problem. + if category == 'problem' and use_new_problem_editor(): + templates_for_category = [ + template for template in templates_for_category if template['boilerplate_name'] == 'blank_common.yaml' + ] + # Add any advanced problem types. Note that these are different xblocks being stored as Advanced Problems, # currently not supported in libraries . - if category == 'problem' and not library: + if category == 'problem' and not library and not use_new_problem_editor(): disabled_block_names = [block.name for block in disabled_xblocks()] advanced_problem_types = [advanced_problem_type for advanced_problem_type in ADVANCED_PROBLEM_TYPES if advanced_problem_type['component'] not in disabled_block_names]