From: Aleksander Ɓukasz Date: Wed, 13 Nov 2013 15:59:28 +0000 (+0100) Subject: Assigning buckets to items in answer description for a question of type "przyporzadkuj" X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/72758198fdbc2106fcfaf2ba903aa73668269cc5?ds=sidebyside;hp=97cfe21a67fcf45235d48bbf68b85a6d0b720204 Assigning buckets to items in answer description for a question of type "przyporzadkuj" --- 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':