From 394b340d9aa9fdd1259e39febe95a8201ebc1cbf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 14 Nov 2013 10:37:30 +0100 Subject: [PATCH 1/1] All-or-nothing answer checking mode for questions of type "wybor" --- wtem/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wtem/models.py b/wtem/models.py index 51515fe..27e1912 100644 --- a/wtem/models.py +++ b/wtem/models.py @@ -113,9 +113,12 @@ class Submission(models.Model): return 0 else: toret = 0 - for id in map(int, answer): - if id in exercise['answer']: - toret += exercise['points_per_hit'] + if exercise.get('answer_mode', None) == 'all_or_nothing': + toret = exercise['points'] if map(int, answer) == exercise['answer'] else 0 + else: + for id in map(int, answer): + if id in exercise['answer']: + toret += exercise['points_per_hit'] return toret if t == 'edumed_prawdafalsz': toret = 0 -- 2.20.1