Set Default Show Answer of Common Problem to Never on Open edX
By default, option show answer of Blank Common Problem component (including multiple choice components, checkboxes, etc.) was set to finished. But this configuration can be override, for example want to set it never as default. Follow the steps below:
-
Go to Open edX server console.
-
Open and edit file
/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/inheritance.py
. -
Find the following codes snippet:
... showanswer = String( display_name=_("Show Answer"), help=_( # Translators: DO NOT translate the words in quotes here, they are # specific words for the acceptable values. 'Specify when the Show Answer button appears for each problem. ' 'Valid values are "always", "answered", "attempted", "closed", ' '"finished", "past_due", "correct_or_past_due", and "never".' ), scope=Scope.settings, default="finished", ) ...
-
Then update the code, change part
default="finished"
from finished to never. See the following codes snippet:... showanswer = String( display_name=_("Show Answer"), help=_( # Translators: DO NOT translate the words in quotes here, they are # specific words for the acceptable values. 'Specify when the Show Answer button appears for each problem. ' 'Valid values are "always", "answered", "attempted", "closed", ' '"finished", "past_due", "correct_or_past_due", and "never".' ), scope=Scope.settings, default="never", ) ...
-
Open and edit file
/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/capa_base.py
. -
Find the following codes snippet:
... showanswer = String( display_name=_("Show Answer"), help=_("Defines when to show the answer to the problem. " "A default value can be set in Advanced Settings."), scope=Scope.settings, default=SHOWANSWER.FINISHED, values=[ {"display_name": _("Always"), "value": SHOWANSWER.ALWAYS}, {"display_name": _("Answered"), "value": SHOWANSWER.ANSWERED}, {"display_name": _("Attempted"), "value": SHOWANSWER.ATTEMPTED}, {"display_name": _("Closed"), "value": SHOWANSWER.CLOSED}, {"display_name": _("Finished"), "value": SHOWANSWER.FINISHED}, {"display_name": _("Correct or Past Due"), "value": SHOWANSWER.CORRECT_OR_PAST_DUE}, {"display_name": _("Past Due"), "value": SHOWANSWER.PAST_DUE}, {"display_name": _("Never"), "value": SHOWANSWER.NEVER}, {"display_name": _("After Some Number of Attempts"), "value": SHOWANSWER.AFTER_SOME_NUMBER_OF_ATTEMPTS}, ] ) ...
-
Then update the code, change part
default=SHOWANSWER.FINISHED
from SHOWANSWER.FINISHED to SHOWANSWER.NEVER. See the following codes snippet:... showanswer = String( display_name=_("Show Answer"), help=_("Defines when to show the answer to the problem. " "A default value can be set in Advanced Settings."), scope=Scope.settings, default=SHOWANSWER.NEVER, values=[ {"display_name": _("Always"), "value": SHOWANSWER.ALWAYS}, {"display_name": _("Answered"), "value": SHOWANSWER.ANSWERED}, {"display_name": _("Attempted"), "value": SHOWANSWER.ATTEMPTED}, {"display_name": _("Closed"), "value": SHOWANSWER.CLOSED}, {"display_name": _("Finished"), "value": SHOWANSWER.FINISHED}, {"display_name": _("Correct or Past Due"), "value": SHOWANSWER.CORRECT_OR_PAST_DUE}, {"display_name": _("Past Due"), "value": SHOWANSWER.PAST_DUE}, {"display_name": _("Never"), "value": SHOWANSWER.NEVER}, {"display_name": _("After Some Number of Attempts"), "value": SHOWANSWER.AFTER_SOME_NUMBER_OF_ATTEMPTS}, ] ) ...
-
Restart LMS and CMS services.