Commit 1a3602d8 by Tim Krones

Fix: Make sure assessment message is up-to-date when submitting last

possible attempt.

Also, reduce number of trips to the server by merging updateReviewTips into updateGrade.
parent 4f6d3f86
......@@ -961,12 +961,6 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
review_tips.append(tip_html)
return review_tips
@XBlock.json_handler
def get_review_tips(self, data, suffix):
return {
'review_tips': self.review_tips
}
def show_extended_feedback(self):
return self.extended_feedback
......@@ -1043,7 +1037,7 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
}
@XBlock.json_handler
def get_score(self, data, suffix):
def get_grade(self, data, suffix):
score = self.score
return {
'score': score.percentage,
......@@ -1053,6 +1047,8 @@ class MentoringWithExplicitStepsBlock(BaseMentoringBlock, StudioContainerWithNes
'correct': self.correct_json(stringify=False),
'incorrect': self.incorrect_json(False),
'partial': self.partial_json(False),
'assessment_message': self.assessment_message,
'assessment_review_tips': self.review_tips,
}
@XBlock.json_handler
......
......@@ -74,7 +74,7 @@ function MentoringWithStepsBlock(runtime, element) {
}
function updateGrade() {
var handlerUrl = runtime.handlerUrl(element, 'get_score');
var handlerUrl = runtime.handlerUrl(element, 'get_grade');
$.post(handlerUrl, JSON.stringify({}))
.success(function(response) {
gradeDOM.data('score', response.score);
......@@ -83,16 +83,9 @@ function MentoringWithStepsBlock(runtime, element) {
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();
});
}
function updateReviewTips() {
var handlerUrl = runtime.handlerUrl(element, 'get_review_tips');
$.post(handlerUrl, JSON.stringify({}))
.success(function(response) {
gradeDOM.data('assessment_review_tips', response.review_tips);
gradeDOM.data('partial', response.partial);
gradeDOM.data('assessment_message', response.assessment_message);
gradeDOM.data('assessment_review_tips', response.assessment_review_tips);
updateControls();
});
}
......
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