From 0b3c27965630297e73fed4d4866ce5079b1d8f73 Mon Sep 17 00:00:00 2001 From: soufiane Date: Thu, 12 Oct 2023 15:32:08 +0200 Subject: [PATCH] wip #6385 @5:00 --- js/quiz.screen.outro.js | 59 ++++++++++++++++++++++++++--- style/106-question-draganddrop.sass | 28 +++++++++++++- 2 files changed, 80 insertions(+), 7 deletions(-) diff --git a/js/quiz.screen.outro.js b/js/quiz.screen.outro.js index f1d7342..5e6b2f0 100644 --- a/js/quiz.screen.outro.js +++ b/js/quiz.screen.outro.js @@ -154,22 +154,69 @@ QuizScreenOutro.prototype = { reviewList = reviewList.map((c, i) => { return { 'question': c['question'], - 'answers': c['answers'].filter((c) => { + 'type': c['type'], + 'correctAnswers': c['answers'].filter((c) => { return c['correct'] === 1 }), - 'status': status[i].ok + 'status': status[i].ok, + 'data': c, } }) let html = ''; for (var i in reviewList) { let review = reviewList[i]; + + let correctAnswers = review.correctAnswers.length > 0 ? review.correctAnswers : review.data.answers + + 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') + } html += '
  • '; - html += '

    ' + this.quiz.l10n.__('Question :index', {index: i + 1}) + '

    '; - html += '

    ' + review.question + '

    '; - for (var j in review.answers) { - html += '

    ' + review.answers[j].answer + '

    '; + html += '

    ' + this.quiz.l10n.__('Question :index', {index: i + 1}) + titleType + '

    '; + + if(review.type === "multiple") { + html += '

    ' + review.question + '

    '; + for (var j in correctAnswers) { + html += '

    ' + correctAnswers[j].answer + '

    '; + } } + + if(review.type === "draganddrop") { + html += '
    ' + for (let i = 1; i < 3; i++) { + let area = i === 1 ? review.data.area_1 : review.data.area_2 + html += '
    ' + html += '

    '+area.title+'

    ' + html += '
      ' + for (let k in correctAnswers) { + if(correctAnswers[k].drop_area === i) { + html += '
    • '+correctAnswers[k].answer+'

    • ' + } + } + html += '
    ' + html += '
    ' + } + html += '
    ' + } + + if(review.type === "match") { + html += '
    ' + for (let k in correctAnswers) { + html += '
    ' + html += '

    '+correctAnswers[k].answer+'

    ' + html += '

    '+correctAnswers[k].proposition+'

    ' + html += '
    ' + } + html += '
    ' + } + html += '
  • '; } $ul.html(html); diff --git a/style/106-question-draganddrop.sass b/style/106-question-draganddrop.sass index 0e5d75f..4584aff 100644 --- a/style/106-question-draganddrop.sass +++ b/style/106-question-draganddrop.sass @@ -36,7 +36,6 @@ left: initial right: 0 - img position: absolute right: 0 @@ -311,3 +310,30 @@ &:not(:nth-child(-n+4)) top: 86px + + + +.slot + width: 100% + height: 51px + transition: all .3s + +radius(8px) + padding: 7px 8px + font-size: 12px + margin-bottom: 8px + + h4 + font-size: 1.25em + font-weight: 600 + max-height: 1.1em + overflow: hidden + text-align: left + + p + font-size: 1em + font-weight: 400 + max-height: 1em + overflow: hidden + text-align: left + white-space: pre-line + margin-top: 3px -- 2.39.5