From 48e7966ef2a2b5ff184d3a37a3037142e0c33c22 Mon Sep 17 00:00:00 2001 From: Arjun Singh Date: Thu, 23 Aug 2012 09:11:13 -0700 Subject: [PATCH] partial credit for an inputfield --- common/lib/capa/capa/correctmap.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common/lib/capa/capa/correctmap.py b/common/lib/capa/capa/correctmap.py index c727626a33..eb6ef2d00c 100644 --- a/common/lib/capa/capa/correctmap.py +++ b/common/lib/capa/capa/correctmap.py @@ -73,10 +73,12 @@ class CorrectMap(object): return answer_id in self.cmap and self.cmap[answer_id]['queuekey'] == test_key def get_npoints(self, answer_id): - if self.is_correct(answer_id): - npoints = self.cmap[answer_id].get('npoints', 1) # default to 1 point if correct - return npoints or 1 - return 0 # if not correct, return 0 + npoints = self.get_property(answer_id, 'npoints') + if npoints is not None: + return npoints + 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): if answer_id in self.cmap: self.cmap[answer_id][property] = value