From 4bdaf3096fb9893cf3cac9a8a183df3ab207876a Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Wed, 14 May 2014 11:26:30 -0400 Subject: [PATCH] Fix question scoring bugs --- karmaworld/assets/js/note-detail.js | 23 +++++++++++------------ karmaworld/templates/notes/note_quiz.html | 2 +- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/karmaworld/assets/js/note-detail.js b/karmaworld/assets/js/note-detail.js index 3f83db2..3181b74 100644 --- a/karmaworld/assets/js/note-detail.js +++ b/karmaworld/assets/js/note-detail.js @@ -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)); } - }); }); } diff --git a/karmaworld/templates/notes/note_quiz.html b/karmaworld/templates/notes/note_quiz.html index b248b70..22b0c53 100644 --- a/karmaworld/templates/notes/note_quiz.html +++ b/karmaworld/templates/notes/note_quiz.html @@ -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 %}" /> {% endif %} -- 2.25.1