Any sage script has 2 parameters: attempt and answers and they should be JSON format. But we should not send whole attempt JSON objects to those script
def run(self, student_answer, answers):
'''
student_answer: {} which is ResponseAttempt json
answers: [{}] which is list of Answer json
'''
matched_answer = []
ignore_case = self.__args__.get('ignore_case', False)
student_answer_value = student_answer
for answer in answers:
if ignore_case:
if answer['content'].lower() == student_answer_value.lower():
matched_answer.append(answer)
break
else:
if answer['content'] == student_answer_value:
matched_answer.append(answer)
break
return matched_answer
Any sage script has 2 parameters: attempt and answers and they should be JSON format. But we should not send whole attempt JSON objects to those script
https://github.com/Mallorne/SciLO/blob/69cd3375bbff0fca84a2d9abdca056218e1c50ba/polls/script/mathexpress.py#L7
=>