Commit db9bed59 by Tim Krones

Return message instead of template from get_message.

parent cd2304e1
...@@ -407,13 +407,13 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC ...@@ -407,13 +407,13 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
""" """
if completed: if completed:
# Student has achieved a perfect score # Student has achieved a perfect score
return self.get_message_html('completed') return self.get_message_content('completed')
elif self.max_attempts_reached: elif self.max_attempts_reached:
# Student has not achieved a perfect score and cannot try again # Student has not achieved a perfect score and cannot try again
return self.get_message_html('max_attempts_reached') return self.get_message_content('max_attempts_reached')
else: else:
# Student did not achieve a perfect score but can try again: # Student did not achieve a perfect score but can try again:
return self.get_message_html('incomplete') return self.get_message_content('incomplete')
@property @property
def assessment_message(self): def assessment_message(self):
...@@ -421,7 +421,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC ...@@ -421,7 +421,7 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
Get the message to display to a student following a submission in assessment mode. Get the message to display to a student following a submission in assessment mode.
""" """
if not self.max_attempts_reached: if not self.max_attempts_reached:
return self.get_message_html('on-assessment-review') return self.get_message_content('on-assessment-review')
else: else:
return None return None
...@@ -689,13 +689,11 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC ...@@ -689,13 +689,11 @@ class MentoringBlock(XBlock, StepParentMixin, StudioEditableXBlockMixin, StudioC
def max_attempts_reached(self): def max_attempts_reached(self):
return self.max_attempts > 0 and self.num_attempts >= self.max_attempts return self.max_attempts > 0 and self.num_attempts >= self.max_attempts
def get_message_html(self, message_type): def get_message_content(self, message_type):
html = u""
for child_id in self.children: for child_id in self.children:
child = self.runtime.get_block(child_id) child = self.runtime.get_block(child_id)
if isinstance(child, MentoringMessageBlock) and child.type == message_type: if isinstance(child, MentoringMessageBlock) and child.type == message_type:
html += child.render('mentoring_view', {}).content # TODO: frament_text_rewriting ? return child.content
return html
def validate(self): def validate(self):
""" """
......
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