From 26f14aaf6d6be3c7d8fee91c63ef54a838ab5686 Mon Sep 17 00:00:00 2001 From: ichuang Date: Sun, 31 Mar 2013 12:21:22 +0000 Subject: [PATCH] fix psychoanalyze (compatibility with new xblock) --- lms/djangoapps/psychometrics/psychoanalyze.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/psychometrics/psychoanalyze.py b/lms/djangoapps/psychometrics/psychoanalyze.py index 008a4034a5..b6072ac997 100644 --- a/lms/djangoapps/psychometrics/psychoanalyze.py +++ b/lms/djangoapps/psychometrics/psychoanalyze.py @@ -329,7 +329,11 @@ def make_psychometrics_data_update_handler(course_id, user, module_state_key): return pmd.done = done - pmd.attempts = state['attempts'] + try: + pmd.attempts = state.get('attempts',0) + except: + log.exception("no attempts for %s (state=%s)" % (sm,sm.state)) + try: checktimes = eval(pmd.checktimes) # update log of attempt timestamps except: