Commit 8e7db1c5 by ichuang

Merge pull request #538 from MITx/feature/arjun/fix_partial_credit

partial credit for an inputfield

May want to couple this (in the future) with some UI feedback to indicate partial credit was awarded.  
parents 1033d881 de70121a
...@@ -73,10 +73,12 @@ class CorrectMap(object): ...@@ -73,10 +73,12 @@ class CorrectMap(object):
return answer_id in self.cmap and self.cmap[answer_id]['queuekey'] == test_key return answer_id in self.cmap and self.cmap[answer_id]['queuekey'] == test_key
def get_npoints(self, answer_id): def get_npoints(self, answer_id):
if self.is_correct(answer_id): npoints = self.get_property(answer_id, 'npoints')
npoints = self.cmap[answer_id].get('npoints', 1) # default to 1 point if correct if npoints is not None:
return npoints or 1 return npoints
return 0 # if not correct, return 0 elif self.is_correct(answer_id):
return 1
return 0 # if not correct and no points have been assigned, return 0
def set_property(self, answer_id, property, value): def set_property(self, answer_id, property, value):
if answer_id in self.cmap: self.cmap[answer_id][property] = value if answer_id in self.cmap: self.cmap[answer_id][property] = value
......
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