Commit af21bbcf by Braden MacDonald

Fix MCQ showing empty tip box even if no tips exist

parent 349b58bb
......@@ -74,17 +74,16 @@ class MCQBlock(QuestionnaireAbstractBlock):
if submission in tip.values:
tips_html.append(tip.render('mentoring_view').content)
formatted_tips = ResourceLoader(__name__).render_template('templates/html/tip_choice_group.html', {
'self': self,
'tips_html': tips_html,
'completed': correct,
})
if tips_html:
formatted_tips = ResourceLoader(__name__).render_template('templates/html/tip_choice_group.html', {
'tips_html': tips_html,
})
self.student_choice = submission
result = {
'submission': submission,
'status': 'correct' if correct else 'incorrect',
'tips': formatted_tips,
'tips': formatted_tips if tips_html else None,
'weight': self.weight,
'score': 1 if correct else 0,
}
......
......@@ -103,9 +103,7 @@ class MRQBlock(QuestionnaireAbstractBlock):
loader = ResourceLoader(__name__)
choice_result['completed'] = choice_completed
choice_result['tips'] = loader.render_template('templates/html/tip_choice_group.html', {
'self': self,
'tips_html': choice_tips_html,
'completed': choice_completed,
})
results.append(choice_result)
......
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