Commit beb43c10 by dragonfi

Add 'partial' as third value of completed

parent f2123cc8
......@@ -115,7 +115,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
score = sum(r[1]['score'] * r[1]['weight'] for r in self.student_results) / total_child_weight
correct = sum(1 for r in self.student_results if r[1]['completed'] is True)
incorrect = sum(1 for r in self.student_results if r[1]['completed'] is False)
partially_correct = sum(1 for r in self.student_results if r[1].get('partially_completed', False) is True)
partially_correct = sum(1 for r in self.student_results if r[1]['completed'] is 'partial')
return (score, int(round(score * 100)), correct, incorrect, partially_correct)
......@@ -217,7 +217,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
child_result = child.submit(submission)
submit_results.append([child.name, child_result])
child.save()
completed = completed and child_result['completed']
completed = completed and (child_result['completed'] is True)
if self.max_attempts_reached:
message = self.get_message_html('max_attempts_reached')
......@@ -257,7 +257,7 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
if not self.completed and self.max_attempts > 0:
self.num_attempts += 1
self.completed = bool(completed)
self.completed = completed is True
raw_score = self.score[0]
......@@ -304,7 +304,6 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
self.student_results.append([child.name, child_result])
child.save()
completed = child_result['completed']
partially_completed = child_result.get('partially_completed', False)
event_data = {}
......@@ -330,7 +329,6 @@ class MentoringBlock(XBlockWithLightChildren, StepParentMixin):
return {
'completed': completed,
'partially_completed': partially_completed,
'attempted': self.attempted,
'max_attempts': self.max_attempts,
'num_attempts': self.num_attempts,
......
......@@ -48,8 +48,6 @@ class MRQBlock(QuestionnaireAbstractBlock):
def submit(self, submissions):
log.debug(u'Received MRQ submissions: "%s"', submissions)
completed = True
partially_completed = False
score = 0
results = []
......@@ -65,8 +63,6 @@ class MRQBlock(QuestionnaireAbstractBlock):
(choice_selected and choice.value in tip.reject_with_defaults)):
choice_completed = False
completed = completed and choice_completed
partially_completed = partially_completed or choice_completed
if choice_completed:
score += 1
......@@ -87,13 +83,11 @@ class MRQBlock(QuestionnaireAbstractBlock):
self.student_choices = submissions
if completed:
partially_completed = False
completed = False if score <= 0 else True if score >= len(results) else 'partial'
result = {
'submissions': submissions,
'completed': completed,
'partially_completed': partially_completed,
'choices': results,
'message': self.message,
'weight': self.weight,
......
......@@ -134,13 +134,11 @@ function MentoringAssessmentView(runtime, element, mentoring) {
$('.attempts', element).data('max_attempts', result.max_attempts);
$('.attempts', element).data('num_attempts', result.num_attempts);
if (result.completed) {
checkmark.addClass('checkmark-correct icon-ok fa-check');
}
else if (result.partially_completed) {
if (result.completed === 'partial') {
checkmark.addClass('checkmark-partially-correct icon-ok fa-check');
}
else {
} else if (result.completed) {
checkmark.addClass('checkmark-correct icon-ok fa-check');
} else {
checkmark.addClass('checkmark-incorrect icon-exclamation fa-exclamation');
}
......
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