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

feat: add waffle flag for beta testing new problem editor parser #35184

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cms/djangoapps/contentstore/toggles.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ def use_new_problem_editor():
return ENABLE_NEW_PROBLEM_EDITOR_FLAG.is_enabled()


# .. toggle_name: new_core_editors.use_advanced_problem_editor
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
# .. toggle_description: This flag enables the use of the new core problem xblock advanced editor as the default
# .. toggle_use_cases: temporary
# .. toggle_creation_date: 2024-07-25
# .. toggle_target_removal_date: 2024-08-31
# .. toggle_tickets: TNL-11694
# .. toggle_warning:
ENABLE_DEFAULT_ADVANCED_PROBLEM_EDITOR_FLAG = WaffleFlag('new_core_editors.use_advanced_problem_editor', __name__)


# .. toggle_name: new_editors.add_game_block_button
# .. toggle_implementation: WaffleFlag
# .. toggle_default: False
Expand Down
7 changes: 6 additions & 1 deletion cms/djangoapps/contentstore/views/tests/test_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ def test_ancestor_info(self, field_type):
problem1 = self.create_xblock(
parent_usage_key=vert_usage_key, display_name="problem1", category="problem"
)
print(problem1)
problem_usage_key = self.response_usage_key(problem1)

def assert_xblock_info(xblock, xblock_info):
Expand Down Expand Up @@ -556,7 +557,11 @@ def assert_xblock_info(xblock, xblock_info):
xblock = parent_xblock
else:
self.assertNotIn("ancestors", response)
self.assertEqual(get_block_info(xblock), response)
xblock_info = get_block_info(xblock)
# TODO: remove after beta testing for the new problem editor parser
if xblock_info["category"] == "problem":
xblock_info["metadata"]["default_to_advanced"] = False
self.assertEqual(xblock_info, response)


@ddt.ddt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from xblock.fields import Scope

from cms.djangoapps.contentstore.config.waffle import SHOW_REVIEW_RULES_FLAG
from cms.djangoapps.contentstore.toggles import ENABLE_DEFAULT_ADVANCED_PROBLEM_EDITOR_FLAG
from cms.djangoapps.models.settings.course_grading import CourseGradingModel
from cms.lib.ai_aside_summary_config import AiAsideSummaryConfig
from common.djangoapps.static_replace import replace_static_urls
Expand Down Expand Up @@ -184,6 +185,11 @@ def handle_xblock(request, usage_key_string=None):
# TODO: pass fields to get_block_info and only return those
with modulestore().bulk_operations(usage_key.course_key):
response = get_block_info(get_xblock(usage_key, request.user))
# TODO: remove after beta testing for the new problem editor parser
if response["category"] == "problem":
response["metadata"]["default_to_advanced"] = (
ENABLE_DEFAULT_ADVANCED_PROBLEM_EDITOR_FLAG.is_enabled()
)
if "customReadToken" in fields:
parent_children = _get_block_parent_children(get_xblock(usage_key, request.user))
response.update(parent_children)
Expand Down
Loading