Commit 2b492956 by Vik Paruchuri

Fix up rubric rendering

parent 0567e8f0
...@@ -2,9 +2,13 @@ from mitxmako.shortcuts import render_to_string ...@@ -2,9 +2,13 @@ from mitxmako.shortcuts import render_to_string
class CombinedOpenEndedRubric: class CombinedOpenEndedRubric:
def render_rubric(self, rubric_xml): @staticmethod
rubric_categories = CombinedOpenEndedRubric.extract_rubric_categories(rubric_xml) def render_rubric(rubric_xml):
html = render_to_string('open_ended_rubric.html', {'rubric_categories' : rubric_categories}) try:
rubric_categories = CombinedOpenEndedRubric.extract_rubric_categories(rubric_xml)
html = render_to_string('open_ended_rubric.html', {'rubric_categories' : rubric_categories})
except:
html = rubric_xml
return html return html
@staticmethod @staticmethod
......
...@@ -21,6 +21,8 @@ from .xml_module import XmlDescriptor ...@@ -21,6 +21,8 @@ from .xml_module import XmlDescriptor
from xmodule.modulestore import Location from xmodule.modulestore import Location
import openendedchild import openendedchild
from combined_open_ended_rubric import CombinedOpenEndedRubric
log = logging.getLogger("mitx.courseware") log = logging.getLogger("mitx.courseware")
class SelfAssessmentModule(openendedchild.OpenEndedChild): class SelfAssessmentModule(openendedchild.OpenEndedChild):
...@@ -120,8 +122,10 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild): ...@@ -120,8 +122,10 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
if self.state == self.INITIAL: if self.state == self.INITIAL:
return '' return ''
rubric_html = CombinedOpenEndedRubric.render_rubric(self.rubric)
# we'll render it # we'll render it
context = {'rubric': self.rubric, context = {'rubric': rubric_html,
'max_score': self._max_score, 'max_score': self._max_score,
} }
......
<div class="assessment"> <div class="assessment">
<div class="rubric"> <div class="rubric">
<h3>Self-assess your answer with this rubric:</h3> <h3>Self-assess your answer with this rubric:</h3>
${rubric} ${rubric | n }
</div> </div>
% if not read_only: % if not read_only:
......
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