Commit b53327a6 by kimth

Correctmap state debugging continued...

parent ff38f5b3
...@@ -101,6 +101,7 @@ class LoncapaProblem(object): ...@@ -101,6 +101,7 @@ class LoncapaProblem(object):
print 'THK: LoncapaProblem.__init__' print 'THK: LoncapaProblem.__init__'
print json.dumps(state['correct_map'], indent=4) print json.dumps(state['correct_map'], indent=4)
self.correct_map.set_dict(state['correct_map']) self.correct_map.set_dict(state['correct_map'])
print json.dumps(self.correct_map.get_dict(), indent=4)
if 'done' in state: if 'done' in state:
self.done = state['done'] self.done = state['done']
......
...@@ -58,10 +58,11 @@ class CorrectMap(object): ...@@ -58,10 +58,11 @@ class CorrectMap(object):
dict of dicts format. dict of dicts format.
''' '''
if correct_map and not (type(correct_map[correct_map.keys()[0]]) == dict): if correct_map and not (type(correct_map[correct_map.keys()[0]]) == dict):
self.__init__() # empty current dict self.__init__() # empty current dict
for k in correct_map: self.set(k, correct_map[k]) # create new dict entries for k in correct_map: self.set(k, correct_map[k]) # create new dict entries
else: else:
self.cmap = correct_map self.__init__()
for k in correct_map: self.set(k, **correct_map[k])
def is_correct(self, answer_id): def is_correct(self, answer_id):
if answer_id in self.cmap: return self.cmap[answer_id]['correctness'] == 'correct' if answer_id in self.cmap: return self.cmap[answer_id]['correctness'] == 'correct'
......
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