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