From b53327a6a45d46aacf9c56714cf66d3a2c277c4e Mon Sep 17 00:00:00 2001 From: kimth Date: Mon, 27 Aug 2012 15:14:12 -0400 Subject: [PATCH] Correctmap state debugging continued... --- common/lib/capa/capa/capa_problem.py | 1 + common/lib/capa/capa/correctmap.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py index 3d9ee27ca0..8edc65b9f9 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -101,6 +101,7 @@ class LoncapaProblem(object): print 'THK: LoncapaProblem.__init__' print json.dumps(state['correct_map'], indent=4) self.correct_map.set_dict(state['correct_map']) + print json.dumps(self.correct_map.get_dict(), indent=4) if 'done' in state: self.done = state['done'] diff --git a/common/lib/capa/capa/correctmap.py b/common/lib/capa/capa/correctmap.py index 4659e2d1e2..ed66643803 100644 --- a/common/lib/capa/capa/correctmap.py +++ b/common/lib/capa/capa/correctmap.py @@ -58,10 +58,11 @@ class CorrectMap(object): dict of dicts format. ''' if correct_map and not (type(correct_map[correct_map.keys()[0]]) == dict): - self.__init__() # empty current dict - for k in correct_map: self.set(k, correct_map[k]) # create new dict entries + self.__init__() # empty current dict + for k in correct_map: self.set(k, correct_map[k]) # create new dict entries else: - self.cmap = correct_map + self.__init__() + for k in correct_map: self.set(k, **correct_map[k]) def is_correct(self, answer_id): if answer_id in self.cmap: return self.cmap[answer_id]['correctness'] == 'correct'