Commit d02b9d9c by Vik Paruchuri

Remove correct map and place state changes in its place

parent c3a91f59
...@@ -295,32 +295,17 @@ class OpenEndedModule(): ...@@ -295,32 +295,17 @@ class OpenEndedModule():
def _update_score(self, score_msg, oldcmap, queuekey): def _update_score(self, score_msg, oldcmap, queuekey):
log.debug(score_msg) log.debug(score_msg)
score_msg = self._parse_score_msg(score_msg) score_msg = self._parse_score_msg(score_msg)
if not score_msg.valid: if not score_msg['valid']:
oldcmap.set(self.answer_id, score_msg['msg'] = 'Invalid grader reply. Please contact the course staff.'
msg = 'Invalid grader reply. Please contact the course staff.')
return oldcmap return oldcmap
correctness = 'correct' if score_msg.correct else 'incorrect' correctness = 'correct' if score_msg.correct else 'incorrect'
# TODO: Find out how this is used elsewhere, if any self._record_latest_score(score_msg['points'])
self.context['correct'] = correctness self._record_latest_feedback(score_msg['msg'])
self.state=self.POST_ASSESSMENT
# Replace 'oldcmap' with new grading results if queuekey matches. If queuekey return True
# does not match, we keep waiting for the score_msg whose key actually matches
if oldcmap.is_right_queuekey(self.answer_id, queuekey):
# Sanity check on returned points
points = score_msg.points
if points < 0:
points = 0
# Queuestate is consumed, so reset it to None
oldcmap.set(self.answer_id, npoints=points, correctness=correctness,
msg = score_msg.msg.replace('&nbsp;', '&#160;'), queuestate=None)
else:
log.debug('OpenEndedResponse: queuekey {0} does not match for answer_id={1}.'.format(
queuekey, self.answer_id))
return oldcmap
def get_answers(self): def get_answers(self):
...@@ -602,11 +587,11 @@ class OpenEndedModule(): ...@@ -602,11 +587,11 @@ class OpenEndedModule():
return None return None
return self.history[-1].get('score') return self.history[-1].get('score')
def latest_hint(self): def latest_feedback(self):
"""None if not available""" """None if not available"""
if not self.history: if not self.history:
return None return None
return self.history[-1].get('hint') return self.history[-1].get('feedback')
def new_history_entry(self, answer): def new_history_entry(self, answer):
self.history.append({'answer': answer}) self.history.append({'answer': answer})
...@@ -616,10 +601,10 @@ class OpenEndedModule(): ...@@ -616,10 +601,10 @@ class OpenEndedModule():
history element""" history element"""
self.history[-1]['score'] = score self.history[-1]['score'] = score
def record_latest_hint(self, hint): def record_latest_feedback(self, feedback):
"""Assumes that state is right, so we're adding a score to the latest """Assumes that state is right, so we're adding a score to the latest
history element""" history element"""
self.history[-1]['hint'] = hint self.history[-1]['feedback'] = feedback
def _allow_reset(self): def _allow_reset(self):
"""Can the module be reset?""" """Can the module be reset?"""
...@@ -699,8 +684,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor): ...@@ -699,8 +684,7 @@ class OpenEndedDescriptor(XmlDescriptor, EditingDescriptor):
{ {
'rubric': 'some-html', 'rubric': 'some-html',
'prompt': 'some-html', 'prompt': 'some-html',
'submitmessage': 'some-html' 'oeparam': 'some-html'
'hintprompt': 'some-html'
} }
""" """
......
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