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 1 commit
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
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 Expand Up @@ -1203,6 +1209,8 @@ def create_xblock_info( # lint-amnesty, pylint: disable=too-many-statements
xblock_info["data"] = data
if metadata is not None:
xblock_info["metadata"] = metadata
# if xblock.category == "problem":
# xblock_info["metadata"]["default_to_advanced"] = ENABLE_DEFAULT_ADVANCED_PROBLEM_EDITOR_FLAG.is_enabled()
if include_ancestor_info:
xblock_info["ancestor_info"] = _create_xblock_ancestor_info(
xblock, course_outline, include_child_info=True
Expand Down
Loading