setup grader type parameter to be paarsed from xml

This commit is contained in:
Vik Paruchuri
2012-11-05 15:30:34 -05:00
committed by Victor Shnayder
parent de6e913d98
commit 8e87d49228

View File

@@ -1852,26 +1852,27 @@ class OpenEndedResponse(LoncapaResponse):
'''
Parse OpenEndedResponse XML:
self.initial_display
self.answer (an answer to display to the student in the LMS)
self.payload
self.grader_type - type of grader to use. One of 'peer','ml','turk'
'''
# Note that OpenEndedResponse is agnostic to the specific contents of grader_payload
grader_payload = oeparam.find('grader_payload')
grader_payload = grader_payload.text if grader_payload is not None else ''
self.payload = {'grader_payload': grader_payload}
answer_display = oeparam.find('answer_display')
if answer_display is not None:
self.answer = answer_display.text
else:
self.answer = 'No answer provided.'
initial_display = oeparam.find('initial_display')
if initial_display is not None:
self.initial_display = initial_display.text
else:
self.initial_display = ''
grader_type = oeparam.find('initial_display')
if grader_type is not None:
self.grader_type = grader_type.text
else:
self.grader_type='ml'
def get_score(self, student_answers):
try:
# Note that submission can be a file
@@ -1910,6 +1911,7 @@ class OpenEndedResponse(LoncapaResponse):
# Submit request. When successful, 'msg' is the prior length of the queue
contents.update({'student_response': submission})
contents.update({'grader_type'} : self.grader_type)
(error, msg) = qinterface.send_to_queue(header=xheader,
body=json.dumps(contents))