Commit ce3b84d0 by Vik Paruchuri

Message passing in lms

parent b782f712
......@@ -186,6 +186,14 @@ class LoncapaProblem(object):
maxscore += responder.get_max_score()
return maxscore
def message_post(self,event_info):
"""
Handle an ajax post that contains feedback on feedback
"""
for responder in self.responders.values():
if hasattr(responder, 'message_post'):
responder.message_post(event_info)
def get_score(self):
"""
Compute score for this problem. The score is the number of points awarded.
......
......@@ -1854,6 +1854,10 @@ class OpenEndedResponse(LoncapaResponse):
prompt = self.xml.find('prompt')
rubric = self.xml.find('openendedrubric')
#This is needed to attach feedback to specific responses later
self.submission_id=None
self.grader_id=None
if oeparam is None:
raise ValueError("No oeparam found in problem xml.")
if prompt is None:
......@@ -2139,13 +2143,15 @@ class OpenEndedResponse(LoncapaResponse):
" Received score_result = {0}".format(score_result))
return fail
for tag in ['score', 'feedback', 'grader_type', 'success']:
for tag in ['score', 'feedback', 'grader_type', 'success', 'grader_id', 'submission_id']:
if tag not in score_result:
log.error("External grader message is missing required tag: {0}"
.format(tag))
return fail
feedback = self._format_feedback(score_result)
self.submission_id=score_result['submission_id']
self.grader_id=score_result['grader_id']
# HACK: for now, just assume it's correct if you got more than 2/3.
# Also assumes that score_result['score'] is an integer.
......
......@@ -402,10 +402,10 @@ class CapaModule(XModule):
event_info = dict()
event_info['state'] = self.lcp.get_state()
event_info['problem_id'] = self.location.url()
event_info['student_id'] = self.system.anonymous_system_id
event_info['student_id'] = self.system.anonymous_student_id
event_info['survey_responses']= get
log.debug(event_info)
success_dict = self.lcp.message_post(event_info)
return {'success' : True}
......
......@@ -203,7 +203,7 @@ class @Problem
fd = new FormData()
feedback = @$('section.evaluation textarea.feedback-on-feedback')[0]
fd.append(feedback.class, feedback.value)
fd.append('feedback', feedback.value)
settings =
type: "POST"
......
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