Commit 334cb206 by Tim Krones

Allow "Complete" and "Incomplete" messages to be used with Step Builder.

Add "On Review" message that is shown when no attempts remain (replacing
"On Assessment Review" message).
parent 67d7371c
......@@ -36,7 +36,7 @@ from xblock.validation import ValidationMessage
from .message import (
MentoringMessageBlock, CompletedMentoringMessageShim, IncompleteMentoringMessageShim,
MaxAttemptsReachedMentoringMessageShim, OnAssessmentReviewMentoringMessageShim
OnReviewMentoringMessageShim
)
from .mixins import _normalize_id, StepParentMixin, QuestionMixin, XBlockWithTranslationServiceMixin
......@@ -920,11 +920,13 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
"""
Get the message to display to a student following a submission in assessment mode.
"""
if not self.max_attempts_reached:
return self.get_message_content('on-assessment-review', or_default=True)
if self.max_attempts_reached:
return self.get_message_content('on-review', or_default=True)
else:
assessment_message = _("Note: you have used all attempts. Continue to the next unit.")
return '<p>{}</p>'.format(assessment_message)
if self.complete: # All answers correct
return self.get_message_content('completed', or_default=True)
else:
return self.get_message_content('incomplete', or_default=True)
@property
def score(self):
......@@ -948,6 +950,10 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
return Score(score, int(round(score * 100)), correct, incorrect, partially_correct)
@property
def complete(self):
return not any(step.answer_status == 'incorrect' for step in self.steps)
@property
def review_tips(self):
""" Get review tips, shown for wrong answers. """
review_tips = []
......@@ -1017,7 +1023,9 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
return [
MentoringStepBlock,
ReviewStepBlock,
NestedXBlockSpec(OnAssessmentReviewMentoringMessageShim, boilerplate='on-assessment-review'),
NestedXBlockSpec(CompletedMentoringMessageShim, boilerplate='completed'),
NestedXBlockSpec(IncompleteMentoringMessageShim, boilerplate='incomplete'),
NestedXBlockSpec(OnReviewMentoringMessageShim, boilerplate='on-review'),
]
@XBlock.json_handler
......
......@@ -48,9 +48,8 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin, XBlockWithTransla
"long_display_name": _(u"Message shown when complete"),
"default": _(u"Great job!"),
"description": _(
u"In standard mode, this message will be shown when the student achieves a "
"perfect score. "
"This message is ignored in assessment mode."
u"This message will be shown when the student achieves a perfect score. "
"Note that it is ignored in Problem Builder blocks using the legacy assessment mode."
),
},
"incomplete": {
......@@ -58,9 +57,9 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin, XBlockWithTransla
"long_display_name": _(u"Message shown when incomplete"),
"default": _(u"Not quite! You can try again, though."),
"description": _(
u"In standard mode, this message will be shown when the student gets at least "
"one question wrong, but is allowed to try again. "
"This message is ignored in assessment mode."
u"This message will be shown when the student gets at least one question wrong, "
"but is allowed to try again. "
"Note that it is ignored in Problem Builder blocks using the legacy assessment mode."
),
},
"max_attempts_reached": {
......@@ -68,9 +67,9 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin, XBlockWithTransla
"long_display_name": _(u"Message shown when student reaches max. # of attempts"),
"default": _(u"Sorry, you have used up all of your allowed submissions."),
"description": _(
u"In standard mode, this message will be shown when the student has used up "
u"This message will be shown when the student has used up "
"all of their allowed attempts without achieving a perfect score. "
"This message is ignored in assessment mode."
"Note that it is ignored in Problem Builder blocks using the legacy assessment mode."
),
},
"on-assessment-review": {
......@@ -101,6 +100,18 @@ class MentoringMessageBlock(XBlock, StudioEditableXBlockMixin, XBlockWithTransla
"used up all of their allowed attempts."
),
},
"on-review": {
"display_name": _(u"Message shown when no attempts left"),
"long_display_name": _(u"Message shown during review when no attempts remain"),
"default": _(
u"Note: you have used all attempts. Continue to the next unit."
),
"description": _(
u"This message will be shown when the student is reviewing their answers to the assessment, "
"if the student has used up all of their allowed attempts. "
"It is not shown if the student is allowed to try again."
),
},
}
content = String(
......@@ -194,11 +205,6 @@ class IncompleteMentoringMessageShim(object):
STUDIO_LABEL = _("Message (Incomplete)")
class MaxAttemptsReachedMentoringMessageShim(object):
CATEGORY = 'pb-message'
STUDIO_LABEL = _("Message (Max # Attempts)")
class OnAssessmentReviewMentoringMessageShim(object):
class OnReviewMentoringMessageShim(object):
CATEGORY = 'pb-message'
STUDIO_LABEL = _("Message (Assessment Review)")
STUDIO_LABEL = _("Message (Review)")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment