Handle empty buckets when checking question of type "przyporzadkuj"
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 13 Nov 2013 15:08:48 +0000 (16:08 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:18:59 +0000 (11:18 +0100)
wtem/models.py

index e29b1bc..69affe4 100644 (file)
@@ -97,7 +97,7 @@ class Submission(models.Model):
                 toret = 0
                 for bucket_id, items in answer.items():
                     for item_id in items:
-                        if int(item_id) == exercise['answer'][bucket_id]: # @@ We assume only one item per bucker for now...
+                        if int(item_id) == exercise['answer'].get(bucket_id, None): # @@ We assume only one item per bucker for now...
                             toret += exercise['points_per_hit']
                 return toret
             if t == 'edumed_wybor':