@@ -793,7 +806,9 @@ class CombinedOpenEndedV1Descriptor(XmlDescriptor, EditingDescriptor):
forchildinexpected_children:
iflen(xml_object.xpath(child))==0:
#This is a staff_facing_error
raiseValueError("Combined Open Ended definition must include at least one '{0}' tag. Contact the learning sciences group for assistance.".format(child))
raiseValueError(
"Combined Open Ended definition must include at least one '{0}' tag. Contact the learning sciences group for assistance.".format(
@@ -83,7 +85,8 @@ class CombinedOpenEndedRubric(object):
rubric_feedback=rubric_dict['html']
ifnotsuccess:
#This is a staff_facing_error
error_message="Could not parse rubric : {0} for location {1}. Contact the learning sciences group for assistance.".format(rubric_string,location.url())
error_message="Could not parse rubric : {0} for location {1}. Contact the learning sciences group for assistance.".format(
rubric_string,location.url())
log.error(error_message)
raiseRubricParsingError(error_message)
...
...
@@ -123,7 +126,9 @@ class CombinedOpenEndedRubric(object):
forcategoryinelement:
ifcategory.tag!='category':
#This is a staff_facing_error
raiseRubricParsingError("[extract_categories] Expected a <category> tag: got {0} instead. Contact the learning sciences group for assistance.".format(category.tag))
raiseRubricParsingError(
"[extract_categories] Expected a <category> tag: got {0} instead. Contact the learning sciences group for assistance.".format(
@@ -150,13 +155,17 @@ class CombinedOpenEndedRubric(object):
# if we are missing the score tag and we are expecting one
elifself.has_score:
#This is a staff_facing_error
raiseRubricParsingError("[extract_category] Category {0} is missing a score. Contact the learning sciences group for assistance.".format(descriptionxml.text))
raiseRubricParsingError(
"[extract_category] Category {0} is missing a score. Contact the learning sciences group for assistance.".format(
descriptionxml.text))
# parse description
ifdescriptionxml.tag!='description':
#This is a staff_facing_error
raiseRubricParsingError("[extract_category]: expected description tag, got {0} instead. Contact the learning sciences group for assistance.".format(descriptionxml.tag))
raiseRubricParsingError(
"[extract_category]: expected description tag, got {0} instead. Contact the learning sciences group for assistance.".format(
descriptionxml.tag))
description=descriptionxml.text
...
...
@@ -167,7 +176,9 @@ class CombinedOpenEndedRubric(object):
foroptioninoptionsxml:
ifoption.tag!='option':
#This is a staff_facing_error
raiseRubricParsingError("[extract_category]: expected option tag, got {0} instead. Contact the learning sciences group for assistance.".format(option.tag))
raiseRubricParsingError(
"[extract_category]: expected option tag, got {0} instead. Contact the learning sciences group for assistance.".format(
option.tag))
else:
pointstr=option.get("points")
ifpointstr:
...
...
@@ -177,13 +188,16 @@ class CombinedOpenEndedRubric(object):
points=int(pointstr)
exceptValueError:
#This is a staff_facing_error
raiseRubricParsingError("[extract_category]: expected points to have int, got {0} instead. Contact the learning sciences group for assistance.".format(pointstr))
raiseRubricParsingError(
"[extract_category]: expected points to have int, got {0} instead. Contact the learning sciences group for assistance.".format(
pointstr))
elifautonumbering:
# use the generated one if we're in the right mode
points=cur_points
cur_points=cur_points+1
else:
raiseException("[extract_category]: missing points attribute. Cannot continue to auto-create points values after a points value is explicitly defined.")
raiseException(
"[extract_category]: missing points attribute. Cannot continue to auto-create points values after a points value is explicitly defined.")
selected=score==points
optiontext=option.text
...
...
@@ -193,19 +207,20 @@ class CombinedOpenEndedRubric(object):
@@ -214,9 +229,9 @@ class CombinedOpenEndedRubric(object):
'has_score':True,
'view_only':True,
'max_score':max_score,
'combined_rubric':True,
'grader_type_image_dict':GRADER_TYPE_IMAGE_DICT,
'human_grader_types':HUMAN_GRADER_TYPE,
'combined_rubric':True,
'grader_type_image_dict':GRADER_TYPE_IMAGE_DICT,
'human_grader_types':HUMAN_GRADER_TYPE,
})
returnhtml
...
...
@@ -228,14 +243,16 @@ class CombinedOpenEndedRubric(object):
'''
iflen(options)==0:
#This is a staff_facing_error
raiseRubricParsingError("[extract_category]: no options associated with this category. Contact the learning sciences group for assistance.")
raiseRubricParsingError(
"[extract_category]: no options associated with this category. Contact the learning sciences group for assistance.")
iflen(options)==1:
return
prev=options[0]['points']
foroptioninoptions[1:]:
ifprev==option['points']:
#This is a staff_facing_error
raiseRubricParsingError("[extract_category]: found duplicate point values between two different options. Contact the learning sciences group for assistance.")
raiseRubricParsingError(
"[extract_category]: found duplicate point values between two different options. Contact the learning sciences group for assistance.")
else:
prev=option['points']
...
...
@@ -250,7 +267,7 @@ class CombinedOpenEndedRubric(object):
@return:
"""
success=False
iflen(scores)==0:
iflen(scores)==0:
#This is a dev_facing_error
log.error("Score length is 0 when trying to reformat rubric scores for rendering.")
returnsuccess,""
...
...
@@ -264,25 +281,25 @@ class CombinedOpenEndedRubric(object):
STAFF_ERROR_MESSAGE='Could not contact the external grading server. Please contact the development team. If you do not have a point of contact, you can contact Vik at vik@edx.org.'
classMockStaffGradingService(object):
"""
A simple mockup of a staff grading service, testing.
"""
def__init__(self):
self.cnt=0
...
...
@@ -45,13 +47,16 @@ class MockStaffGradingService(object):
'Peer Grading':"View all problems that require peer assessment in this particular course.",
'Staff Grading':"View ungraded submissions submitted by students for the open ended problems in the course.",
'Problems you have submitted':"View open ended problems that you have previously submitted for grading.",
'Flagged Submissions':"View submissions that have been flagged by students as inappropriate."
}
}
ALERT_DICT={
'Peer Grading':"New submissions to grade",
'Staff Grading':"New submissions to grade",
'Problems you have submitted':"New grades have been returned",
'Flagged Submissions':"Submissions have been flagged for review"
}
}
STUDENT_ERROR_MESSAGE="Error occured while contacting the grading service. Please notify course staff."
STAFF_ERROR_MESSAGE="Error occured while contacting the grading service. Please notify the development team. If you do not have a point of contact, please email Vik at vik@edx.org"
returnHttpResponse(json.dumps({'success':False,'error':STAFF_ERROR_MESSAGE+'Missing key {0} from submission. Please reload and try again.'.format(key)}),
returnHttpResponse(json.dumps({'success':False,
'error':STAFF_ERROR_MESSAGE+'Missing key {0} from submission. Please reload and try again.'.format(