All-or-nothing answer checking mode for questions of type "wybor"
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Nov 2013 09:37:30 +0000 (10:37 +0100)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Wed, 15 Jan 2014 10:19:00 +0000 (11:19 +0100)
wtem/models.py

index 51515fe..27e1912 100644 (file)
@@ -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