From: Aleksander Ɓukasz Date: Wed, 13 Nov 2013 15:08:48 +0000 (+0100) Subject: Handle empty buckets when checking question of type "przyporzadkuj" X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/e8035f42434faf0ffcb1897f6783c64d5751ae20?hp=120f6cf55e29d931420df2ce1f63d933f1d6a612 Handle empty buckets when checking question of type "przyporzadkuj" --- diff --git a/wtem/models.py b/wtem/models.py index e29b1bc..69affe4 100644 --- a/wtem/models.py +++ b/wtem/models.py @@ -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':