Commit e5a75576 by Tim Krones

Make sure data relevant for displaying review links is up-to-date when

displaying review step.
parent 8133e633
...@@ -989,18 +989,21 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes ...@@ -989,18 +989,21 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
def show_extended_feedback(self): def show_extended_feedback(self):
return self.extended_feedback return self.extended_feedback
def feedback_dispatch(self, target_data): def feedback_dispatch(self, target_data, stringify):
if self.show_extended_feedback(): if self.show_extended_feedback():
return json.dumps(target_data) if stringify:
return json.dumps(target_data)
else:
return target_data
def correct_json(self): def correct_json(self, stringify=True):
return self.feedback_dispatch(self.score.correct) return self.feedback_dispatch(self.score.correct, stringify)
def incorrect_json(self): def incorrect_json(self, stringify=True):
return self.feedback_dispatch(self.score.incorrect) return self.feedback_dispatch(self.score.incorrect, stringify)
def partial_json(self): def partial_json(self, stringify=True):
return self.feedback_dispatch(self.score.partially_correct) return self.feedback_dispatch(self.score.partially_correct, stringify)
def get_message_content(self, message_type, or_default=False): def get_message_content(self, message_type, or_default=False):
for child_id in self.children: for child_id in self.children:
...@@ -1095,6 +1098,9 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes ...@@ -1095,6 +1098,9 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
'correct_answers': len(self.score.correct), 'correct_answers': len(self.score.correct),
'incorrect_answers': len(self.score.incorrect), 'incorrect_answers': len(self.score.incorrect),
'partially_correct_answers': len(self.score.partially_correct), 'partially_correct_answers': len(self.score.partially_correct),
'correct': self.correct_json(stringify=False),
'incorrect': self.incorrect_json(False),
'partial': self.partial_json(False),
} }
@XBlock.json_handler @XBlock.json_handler
......
...@@ -81,6 +81,9 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -81,6 +81,9 @@ function MentoringWithStepsBlock(runtime, element) {
gradeDOM.data('correct_answer', response.correct_answers); gradeDOM.data('correct_answer', response.correct_answers);
gradeDOM.data('incorrect_answer', response.incorrect_answers); gradeDOM.data('incorrect_answer', response.incorrect_answers);
gradeDOM.data('partially_correct_answer', response.partially_correct_answers); gradeDOM.data('partially_correct_answer', response.partially_correct_answers);
gradeDOM.data('correct', response.correct);
gradeDOM.data('incorrect', response.incorrect);
gradeDOM.data('partially', response.partial);
updateReviewTips(); updateReviewTips();
}); });
} }
......
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