From: Charles Connell Date: Wed, 14 May 2014 15:26:30 +0000 (-0400) Subject: Fix question scoring bugs X-Git-Tag: release-20150131~78 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4bdaf3096fb9893cf3cac9a8a183df3ab207876a;p=oweals%2Fkarmaworld.git Fix question scoring bugs --- 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 %}