Commit dfec4fa7 by Braden MacDonald

Address initial review comments, fix bug with perfect_score

parent cc9498cd
...@@ -22,7 +22,7 @@ function MentoringWithStepsBlock(runtime, element, params) { ...@@ -22,7 +22,7 @@ function MentoringWithStepsBlock(runtime, element, params) {
var message = $('.sb-step-message', element); var message = $('.sb-step-message', element);
var checkmark, submitDOM, nextDOM, reviewButtonDOM, tryAgainDOM, var checkmark, submitDOM, nextDOM, reviewButtonDOM, tryAgainDOM,
gradeDOM, attemptsDOM, reviewLinkDOM, submitXHR; gradeDOM, attemptsDOM, reviewLinkDOM, submitXHR;
var reviewStepDOM = $("[data-block-type=sb-review-step]", element); var reviewStepDOM = $("div.xblock[data-block-type=sb-review-step], div.xblock-v1[data-block-type=sb-review-step]", element);
var hasAReviewStep = reviewStepDOM.length == 1; var hasAReviewStep = reviewStepDOM.length == 1;
function isLastStep() { function isLastStep() {
......
...@@ -100,7 +100,7 @@ class ConditionalMessageBlock( ...@@ -100,7 +100,7 @@ class ConditionalMessageBlock(
): ):
return False return False
perfect_score = (score_summary['incorrect'] == 0 and score_summary['partial'] == 0) perfect_score = (score_summary['incorrect_answers'] == 0 and score_summary['partially_correct_answers'] == 0)
if ( if (
(self.score_condition == self.SCORE_PERFECT and not perfect_score) or (self.score_condition == self.SCORE_PERFECT and not perfect_score) or
(self.score_condition == self.SCORE_IMPERFECT and perfect_score) (self.score_condition == self.SCORE_IMPERFECT and perfect_score)
...@@ -109,7 +109,7 @@ class ConditionalMessageBlock( ...@@ -109,7 +109,7 @@ class ConditionalMessageBlock(
return True return True
def student_view(self, context=None): def student_view(self, _context=None):
""" Render this message. """ """ Render this message. """
html = u'<div class="review-conditional-message">{content}</div>'.format( html = u'<div class="review-conditional-message">{content}</div>'.format(
content=self.content content=self.content
...@@ -136,7 +136,7 @@ class ConditionalMessageBlock( ...@@ -136,7 +136,7 @@ class ConditionalMessageBlock(
@XBlock.needs("i18n") @XBlock.needs("i18n")
class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixin, XBlock): class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixin, XBlock):
""" """
Summaryize the score that the student earned. Summarize the score that the student earned.
""" """
CATEGORY = 'sb-review-score' CATEGORY = 'sb-review-score'
STUDIO_LABEL = _("Score Summary") STUDIO_LABEL = _("Score Summary")
...@@ -148,12 +148,14 @@ class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixi ...@@ -148,12 +148,14 @@ class ScoreSummaryBlock(XBlockWithTranslationServiceMixin, XBlockWithPreviewMixi
def student_view(self, context=None): def student_view(self, context=None):
""" Render the score summary message. """ """ Render the score summary message. """
context = context or {}
html = loader.render_template("templates/html/sb-review-score.html", context.get("score_summary", {})) html = loader.render_template("templates/html/sb-review-score.html", context.get("score_summary", {}))
return Fragment(html) return Fragment(html)
mentoring_view = student_view # Same as student_view but Studio won't wrap it with the editing header/buttons mentoring_view = student_view # Same as student_view but Studio won't wrap it with the editing header/buttons
def author_view(self, context=None): def author_view(self, context=None):
context = context or {}
if not context.get("score_summary"): if not context.get("score_summary"):
context["score_summary"] = { context["score_summary"] = {
'score': 75, 'score': 75,
...@@ -199,6 +201,7 @@ class PerQuestionFeedbackBlock(XBlockWithTranslationServiceMixin, XBlockWithPrev ...@@ -199,6 +201,7 @@ class PerQuestionFeedbackBlock(XBlockWithTranslationServiceMixin, XBlockWithPrev
def author_view(self, context=None): def author_view(self, context=None):
""" Show example content in Studio """ """ Show example content in Studio """
context = context or {}
if not context.get("per_question_review_tips"): if not context.get("per_question_review_tips"):
example = self._("(Example tip:) Since you got Question 1 wrong, review Chapter 12 of your textbook.") example = self._("(Example tip:) Since you got Question 1 wrong, review Chapter 12 of your textbook.")
context["score_summary"] = {"review_tips": [example]} context["score_summary"] = {"review_tips": [example]}
...@@ -270,7 +273,7 @@ class ReviewStepBlock( ...@@ -270,7 +273,7 @@ class ReviewStepBlock(
mentoring_view = student_view mentoring_view = student_view
def studio_view(self, context=None): def studio_view(self, _context=None):
""" Studio View """ """ Studio View """
return Fragment(u'<p>{}</p>'.format(self._("This XBlock does not have any settings."))) return Fragment(u'<p>{}</p>'.format(self._("This XBlock does not have any settings.")))
......
{% load i18n %} {% load i18n %}
<!-- Tips about specific questions the student got wrong. From pb-message[type=on-assessment-review-question] blocks --> {# Tips about specific questions the student got wrong. From pb-message[type=on-assessment-review-question] blocks #}
<p class="review-tips-intro">{% trans "You might consider reviewing the following items before your next assessment attempt:" %}</p> <p class="review-tips-intro">{% trans "You might consider reviewing the following items before your next assessment attempt:" %}</p>
<ul class="review-tips-list"> <ul class="review-tips-list">
{% for tip in tips %} {% for tip in tips %}
......
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