From 30f3923c156fb49e69525e8649aa83619349bbb7 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Thu, 7 Mar 2013 23:50:09 -0500 Subject: [PATCH 1/2] Quick patch to regression causing partial credit to break on 6.00x --- common/lib/capa/capa/correctmap.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/lib/capa/capa/correctmap.py b/common/lib/capa/capa/correctmap.py index f246b406d5..fd83fc29f8 100644 --- a/common/lib/capa/capa/correctmap.py +++ b/common/lib/capa/capa/correctmap.py @@ -115,11 +115,13 @@ class CorrectMap(object): If the answer is correct, return the assigned number of points (default: 1 point) Otherwise, return 0 points """ - if self.is_correct(answer_id): - npoints = self.get_property(answer_id, 'npoints') - return npoints if npoints is not None else 1 - else: - return 0 + npoints = self.get_property(answer_id, 'npoints') + if npoints is not None: + return npoints + elif self.is_correct(answer_id): + return 1 + # if not correct and no points have been assigned, return 0 + return 0 def set_property(self, answer_id, property, value): if answer_id in self.cmap: From 5f44b2de04f005dd17f917b47c28d0382ea397ec Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Thu, 7 Mar 2013 23:52:01 -0500 Subject: [PATCH 2/2] minor comment on partial credit --- common/lib/capa/capa/correctmap.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/lib/capa/capa/correctmap.py b/common/lib/capa/capa/correctmap.py index fd83fc29f8..ea56863a2f 100644 --- a/common/lib/capa/capa/correctmap.py +++ b/common/lib/capa/capa/correctmap.py @@ -111,10 +111,7 @@ class CorrectMap(object): return None def get_npoints(self, answer_id): - """ Return the number of points for an answer: - If the answer is correct, return the assigned - number of points (default: 1 point) - Otherwise, return 0 points """ + """Return the number of points for an answer, used for partial credit.""" npoints = self.get_property(answer_id, 'npoints') if npoints is not None: return npoints