Fix question scoring bugs
authorCharles Connell <charles@connells.org>
Wed, 14 May 2014 15:26:30 +0000 (11:26 -0400)
committerCharles Connell <charles@connells.org>
Wed, 14 May 2014 15:26:30 +0000 (11:26 -0400)
karmaworld/assets/js/note-detail.js
karmaworld/templates/notes/note_quiz.html

index 3f83db2c6f7cd2d3126ef0ff26403d59a8d1a6f3..3181b74e2e4af25f1a1a031e95c0195c231c529b 100644 (file)
@@ -318,22 +318,21 @@ function initQuizPage() {
         }
       }
 
-      var matching_correct = false;
+
       var options_selected = $(this).find('option:selected');
       if (options_selected.length > 0) {
-        matching_correct = true
-      }
-      options_selected.each(function() {
-        if ($(this).data('correct') == false) {
-          matching_correct = false;
+        var matching_correct = true;
+        options_selected.each(function() {
+          if ($(this).data('correct') == false) {
+            matching_correct = false;
+          }
+        });
+        if (matching_correct) {
+          markQuestionCorrect($(this));
+        } else {
+          markQuestionIncorrect($(this));
         }
-      });
-      if (matching_correct) {
-        markQuestionCorrect($(this));
-      } else {
-        markQuestionIncorrect($(this));
       }
-
     });
   });
 }
index b248b705d54df37813169340e9e11ba686be8661..22b0c531683322eee49b76eb782b013a386592e7 100644 (file)
@@ -57,7 +57,7 @@
                        name="group_{{ forloop.counter0 }}"
                        id="choice_{{ forloop.counter0 }}_false"
                        value="choice_{{ forloop.counter0 }}_false"
-                       data-correct="{% if question.false %}true{% else %}false{% endif %}" />
+                       data-correct="{% if question.true %}false{% else %}true{% endif %}" />
                 <label for="choice_{{ forloop.counter0 }}_false">False</label>
               </div>
             {% endif %}