},
getNormalizedScore: function (pct) {
- var s = this.score / this.getQuestionsCount();
+ var s = this.score / this.getQuestionsCount(true);
if (pct === undefined || pct === false) {
return s;
}
}
},
- getQuestionsCount: function () {
- return this.quiz.data.questions.length;
+ getQuestionsCount: function (onlyForScore) {
+ if (onlyForScore === true) {
+ let res = 0;
+ for (let i in this.quiz.data.questions) {
+ if (this.quiz.data.questions[i].count_for_score) {
+ res++;
+ }
+ }
+ return res;
+ }
+ this.quiz.data.questions.length;
},
getCurrentState: function () {
this.quiz.score.runEndAction();
this.quiz.attemptsLog.log();
+ if (this.quiz.score.isPassed() || this.quiz.scorm.enabled) {
+ $(".restart,.restart-sentence,.restart-sentence-mobile").hide();
+ }
+
this.animate(score, percent)
this.displayReviewList()
this.checkScorm()
let correctAnswers = review.correctAnswers.length > 0 ? review.correctAnswers : review.data.answers
- console.log("review",review)
- console.log("correctAnswers",correctAnswers)
+ console.log("review", review)
+ console.log("correctAnswers", correctAnswers)
let titleType = '';
- if(review.type === "draganddrop") {
- titleType = ' - '+this.quiz.l10n.__('Drag and Drop')
- } else if(review.type === "match") {
- titleType = ' - '+this.quiz.l10n.__('Match the answers')
+ if (review.type === "draganddrop") {
+ titleType = ' - ' + this.quiz.l10n.__('Drag and Drop')
+ } else if (review.type === "match") {
+ titleType = ' - ' + this.quiz.l10n.__('Match the answers')
}
html += '<li class="item ' + review.status + '">';
html += '<p class="position">' + this.quiz.l10n.__('Question :index', {index: i + 1}) + titleType + '</p>';
- if(review.type === "multiple") {
+ if (review.type === "multiple") {
html += '<p class="question">' + review.question + '</p>';
for (var j in correctAnswers) {
html += '<p class="answer">' + correctAnswers[j].answer + '</p>';
}
}
- if(review.type === "draganddrop") {
+ if (review.type === "draganddrop") {
html += '<div class="area-title">'
- html += '<p>'+review.data.area_1.title+'</p><p>'+review.data.area_2.title+'</p>'
+ html += '<p>' + review.data.area_1.title + '</p><p>' + review.data.area_2.title + '</p>'
html += '</div>'
html += '<div class="area-container">'
for (let i = 1; i < 3; i++) {
let area = i === 1 ? review.data.area_1 : review.data.area_2
- html += '<div class="area area"'+i+'>'
+ html += '<div class="area area"' + i + '>'
html += '<ul class="area-list card-holder">'
for (let k in correctAnswers) {
- if(correctAnswers[k].drop_area === i) {
- html += '<li class="area-item slot active"><p>'+correctAnswers[k].answer+'</p></li>'
+ if (correctAnswers[k].drop_area === i) {
+ html += '<li class="area-item slot active"><p>' + correctAnswers[k].answer + '</p></li>'
}
}
html += '</ul>'
html += '</div>'
}
- if(review.type === "match") {
+ if (review.type === "match") {
html += '<div class="match-container">'
html += '<div class="match-title">'
- html += '<p>'+this.quiz.l10n.__('Question')+'</p><p>'+this.quiz.l10n.__('Answers')+'</p>'
+ html += '<p>' + this.quiz.l10n.__('Question') + '</p><p>' + this.quiz.l10n.__('Answers') + '</p>'
html += '</div>'
for (let k in correctAnswers) {
html += '<div class="match-wrapper card-holder">'
- html += '<div class="match-item slot active"><p>'+correctAnswers[k].answer+'</p></div>'
- html += '<div class="match-item slot active"><p>'+correctAnswers[k].proposition+'</p></div>'
+ html += '<div class="match-item slot active"><p>' + correctAnswers[k].answer + '</p></div>'
+ html += '<div class="match-item slot active"><p>' + correctAnswers[k].proposition + '</p></div>'
html += '</div>'
}
html += '</div>'