diff --git a/common/lib/xmodule/xmodule/combined_open_ended_modulev1.py b/common/lib/xmodule/xmodule/combined_open_ended_modulev1.py index 09f89f5756..8ea27ce867 100644 --- a/common/lib/xmodule/xmodule/combined_open_ended_modulev1.py +++ b/common/lib/xmodule/xmodule/combined_open_ended_modulev1.py @@ -8,6 +8,7 @@ from lxml.html import rewrite_links from path import path import os import sys +import re from pkg_resources import resource_string @@ -462,6 +463,10 @@ class CombinedOpenEndedV1Module(): human_state = task.HUMAN_NAMES[state] else: human_state = state + if len(grader_types)>0: + grader_type = grader_types[0] + else: + grader_type = "IN" last_response_dict = { 'response': last_response, 'score': last_score, @@ -477,7 +482,7 @@ class CombinedOpenEndedV1Module(): 'rubric_scores' : rubric_scores, 'grader_types' : grader_types, 'feedback_items' : feedback_items, - 'grader_type' : grader_types[0], + 'grader_type' : grader_type, } return last_response_dict @@ -648,6 +653,7 @@ class CombinedOpenEndedV1Module(): task_data = self.get_last_response(i) task_data.update({'task_number': i + 1}) status.append(task_data) + context = {'status_list': status, 'grader_type_image_dict' : GRADER_TYPE_IMAGE_DICT} status_html = self.system.render_template("combined_open_ended_status.html", context) diff --git a/common/lib/xmodule/xmodule/open_ended_module.py b/common/lib/xmodule/xmodule/open_ended_module.py index 8ba85eef0e..2feab3e035 100644 --- a/common/lib/xmodule/xmodule/open_ended_module.py +++ b/common/lib/xmodule/xmodule/open_ended_module.py @@ -429,7 +429,7 @@ class OpenEndedModule(openendedchild.OpenEndedChild): correct: Correctness of submission (Boolean) score: Points to be assigned (numeric, can be float) """ - fail = {'valid': False, 'score': 0, 'feedback': '', 'rubric_scores' : [], 'grader_types' : [], 'feedback_items' : []} + fail = {'valid': False, 'score': 0, 'feedback': '', 'rubric_scores' : [[0,0]], 'grader_types' : [''], 'feedback_items' : ['']} try: score_result = json.loads(score_msg) except (TypeError, ValueError): diff --git a/lms/templates/combined_open_ended_status.html b/lms/templates/combined_open_ended_status.html index d2c6ab1224..7d803fc230 100644 --- a/lms/templates/combined_open_ended_status.html +++ b/lms/templates/combined_open_ended_status.html @@ -7,8 +7,9 @@ %else:
%endif - - <% grader_image = grader_type_image_dict[status['grader_type']]%> + %if status['grader_type'] in grader_type_image_dict: + <% grader_image = grader_type_image_dict[status['grader_type']]%> + %endif ${status['human_task']}(${status['human_state']}) ${status['score']} / ${status['max_score']}
%endfor diff --git a/lms/templates/open_ended_rubric.html b/lms/templates/open_ended_rubric.html index 47300508d0..372dc2230a 100644 --- a/lms/templates/open_ended_rubric.html +++ b/lms/templates/open_ended_rubric.html @@ -28,8 +28,10 @@ % elif combined_rubric == True:
%for grader_type in category['options'][j]['grader_types']: - <% grader_image = grader_type_image_dict[grader_type]%> - + % if grader_type in grader_type_image_dict: + <% grader_image = grader_type_image_dict[grader_type]%> + + % endif %endfor ${option['points']} points : ${option['text']}