Commit a7a55e46 by Vik Paruchuri

Create a combined results view

parent 4421e09d
...@@ -586,10 +586,22 @@ class CombinedOpenEndedV1Module(): ...@@ -586,10 +586,22 @@ class CombinedOpenEndedV1Module():
loop_up_to_task = self.current_task_number+1 loop_up_to_task = self.current_task_number+1
for i in xrange(0,loop_up_to_task): for i in xrange(0,loop_up_to_task):
all_responses.append(self.get_last_response(i)) 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 = { context = {
'results': response_dict['post_assessment'], 'rubric_html': self.rubric_renderer.render_rubric(stringify_children(self.static_data['rubric']), ri['rubric_scores'][i]),
'task_number': task_number + 1, 'grader_type': ri['grader_type'],
'task_name' : response_dict['human_task'], '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': feedback_table,
'task_name' : "Combined Results",
'class_name' : "result-container", 'class_name' : "result-container",
} }
html = self.system.render_template('combined_open_ended_results.html', context) html = self.system.render_template('combined_open_ended_results.html', context)
......
...@@ -37,7 +37,7 @@ class CombinedOpenEndedRubric(object): ...@@ -37,7 +37,7 @@ class CombinedOpenEndedRubric(object):
self.view_only = view_only self.view_only = view_only
self.system = system 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 render_rubric: takes in an xml string and outputs the corresponding
html for that xml, given the type of rubric we're generating html for that xml, given the type of rubric we're generating
...@@ -48,8 +48,14 @@ class CombinedOpenEndedRubric(object): ...@@ -48,8 +48,14 @@ class CombinedOpenEndedRubric(object):
html: the html that corresponds to the xml given html: the html that corresponds to the xml given
''' '''
success = False success = False
#try: try:
rubric_categories = self.extract_categories(rubric_xml) 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] rubric_scores = [cat['score'] for cat in rubric_categories]
max_scores = map((lambda cat: cat['options'][-1]['points']), rubric_categories) max_scores = map((lambda cat: cat['options'][-1]['points']), rubric_categories)
max_score = max(max_scores) max_score = max(max_scores)
...@@ -64,10 +70,10 @@ class CombinedOpenEndedRubric(object): ...@@ -64,10 +70,10 @@ class CombinedOpenEndedRubric(object):
'combined_rubric' : False 'combined_rubric' : False
}) })
success = True success = True
#except: except:
# error_message = "[render_rubric] Could not parse the rubric with xml: {0}".format(rubric_xml) error_message = "[render_rubric] Could not parse the rubric with xml: {0}".format(rubric_xml)
# log.error(error_message) log.error(error_message)
# raise RubricParsingError(error_message) raise RubricParsingError(error_message)
return {'success' : success, 'html' : html, 'rubric_scores' : rubric_scores} return {'success' : success, 'html' : html, 'rubric_scores' : rubric_scores}
def check_if_rubric_is_parseable(self, rubric_string, location, max_score_allowed, max_score): 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 @@ ...@@ -5,7 +5,7 @@
% for j in range(len(category['options'])): % for j in range(len(category['options'])):
<% option = category['options'][j] %> <% option = category['options'][j] %>
% if option['selected']: % if option['selected']:
${category['description']} : ${option['points']} points ${category['description']} : ${option['points']} points ,
% endif % endif
% endfor % endfor
% 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