From 72758198fdbc2106fcfaf2ba903aa73668269cc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 13 Nov 2013 16:59:28 +0100 Subject: [PATCH 1/1] Assigning buckets to items in answer description for a question of type "przyporzadkuj" --- wtem/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wtem/models.py b/wtem/models.py index 4038485..51515fe 100644 --- a/wtem/models.py +++ b/wtem/models.py @@ -97,7 +97,12 @@ class Submission(models.Model): toret = 0 for bucket_id, items in answer.items(): for item_id in items: - if int(item_id) in exercise['answer'].get(bucket_id, []): + is_corect = False + if exercise.get('answer_mode', None) == 'possible_buckets_for_item': + is_correct = int(bucket_id) in exercise['answer'].get(item_id) + else: + is_correct = int(item_id) in exercise['answer'].get(bucket_id, []) + if is_correct: toret += exercise['points_per_hit'] return toret if t == 'edumed_wybor': -- 2.20.1