]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wait #6654 @0:20
authorsoufiane <soufiane@cubedesigners.com>
Tue, 23 Jan 2024 11:56:10 +0000 (12:56 +0100)
committersoufiane <soufiane@cubedesigners.com>
Tue, 23 Jan 2024 11:56:10 +0000 (12:56 +0100)
js/quiz.score.js

index 991ab4a6369c064f4baf3d12ddd35b400080e119..166c7ea5288f820b6a61dc8118c881a3500dd5c1 100644 (file)
@@ -99,7 +99,6 @@ QuizScore.prototype = {
                 this_score = 0;
                 for (let answerIndex in question.answers) {
                     const answer = question.answers[answerIndex];
-                    console.log("answer.drop_area", answer.drop_area, "userAnswers[answerIndex]", userAnswers[answerIndex])
                     this_score += ((answer.drop_area === userAnswers[answerIndex]) ? answer.score : 0);
 
                     if(answer.drop_area !== userAnswers[answerIndex]) {
@@ -115,13 +114,15 @@ QuizScore.prototype = {
                 min_score = this.getMinScore(question);
                 this_score = 0;
                 for (let k in userAnswers) {
+                    const answer = question.answers[k];
                     if (parseInt(k) === parseInt(userAnswers[k])) {
                         answersStatus[k] = 'ok'
-                        this_score = userAnswers[k].score
+                        this_score += answer.score
                     } else {
                         answersStatus[k] = 'nok'
                     }
                 }
+
                 ok = this_score >= min_score ? 'ok' : 'nok';
                 log.answer = userAnswers;
             } else {