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