Commit a7a55e46 by Vik Paruchuri

Create a combined results view

parent 4421e09d
......@@ -586,12 +586,24 @@ class CombinedOpenEndedV1Module():
loop_up_to_task = self.current_task_number+1
for i in xrange(0,loop_up_to_task):
all_responses.append(self.get_last_response(i))
context_list = []
for ri in all_responses:
for i in xrange(0,len(ri['rubric_scores'])):
feedback = ri['feedback_dicts'][i].get('feedback','')
context = {
'rubric_html': self.rubric_renderer.render_rubric(stringify_children(self.static_data['rubric']), ri['rubric_scores'][i]),
'grader_type': ri['grader_type'],
'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT,
'human_grader_types' : HUMAN_GRADER_TYPE,
'feedback' : feedback,
}
context_list.append(context)
feedback_table = self.system.render_template('open_ended_result_table.html', context_list)
context = {
'results': response_dict['post_assessment'],
'task_number': task_number + 1,
'task_name' : response_dict['human_task'],
'results': feedback_table,
'task_name' : "Combined Results",
'class_name' : "result-container",
}
}
html = self.system.render_template('combined_open_ended_results.html', context)
return {'html': html, 'success': True}
......
......@@ -37,7 +37,7 @@ class CombinedOpenEndedRubric(object):
self.view_only = view_only
self.system = system
def render_rubric(self, rubric_xml):
def render_rubric(self, rubric_xml, score_list = None):
'''
render_rubric: takes in an xml string and outputs the corresponding
html for that xml, given the type of rubric we're generating
......@@ -48,26 +48,32 @@ class CombinedOpenEndedRubric(object):
html: the html that corresponds to the xml given
'''
success = False
#try:
rubric_categories = self.extract_categories(rubric_xml)
rubric_scores = [cat['score'] for cat in rubric_categories]
max_scores = map((lambda cat: cat['options'][-1]['points']), rubric_categories)
max_score = max(max_scores)
rubric_template = 'open_ended_rubric.html'
if self.view_only:
rubric_template = 'open_ended_view_only_rubric.html'
html = self.system.render_template(rubric_template,
{'categories': rubric_categories,
'has_score': self.has_score,
'view_only': self.view_only,
'max_score': max_score,
'combined_rubric' : False
})
success = True
#except:
# error_message = "[render_rubric] Could not parse the rubric with xml: {0}".format(rubric_xml)
# log.error(error_message)
# raise RubricParsingError(error_message)
try:
rubric_categories = self.extract_categories(rubric_xml)
if score_list:
for i in xrange(0,len(rubric_categories)):
category = rubric_categories[i]
for j in xrange(0,len(category['options'])):
if score_list[i]==j:
rubric_categories[i]['options'][j]['selected'] = True
rubric_scores = [cat['score'] for cat in rubric_categories]
max_scores = map((lambda cat: cat['options'][-1]['points']), rubric_categories)
max_score = max(max_scores)
rubric_template = 'open_ended_rubric.html'
if self.view_only:
rubric_template = 'open_ended_view_only_rubric.html'
html = self.system.render_template(rubric_template,
{'categories': rubric_categories,
'has_score': self.has_score,
'view_only': self.view_only,
'max_score': max_score,
'combined_rubric' : False
})
success = True
except:
error_message = "[render_rubric] Could not parse the rubric with xml: {0}".format(rubric_xml)
log.error(error_message)
raise RubricParsingError(error_message)
return {'success' : success, 'html' : html, 'rubric_scores' : rubric_scores}
def check_if_rubric_is_parseable(self, rubric_string, location, max_score_allowed, max_score):
......
% for context in context_list:
% if context['grader_type'] in grader_type_image_dict:
<% grader_image = grader_type_image_dict[grader_type] %>
% if grader_type in human_grader_types:
<% human_title = human_grader_types[grader_type] %>
% else:
<% human_title = grader_type %>
% endif
<img src="${grader_image}" title="${human_title}"/>
% endif
${rubric_html}
${feedback}
%endif
%endfor
\ No newline at end of file
......@@ -5,7 +5,7 @@
% for j in range(len(category['options'])):
<% option = category['options'][j] %>
% if option['selected']:
${category['description']} : ${option['points']} points
${category['description']} : ${option['points']} points ,
% endif
% endfor
% endfor
......
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