]> _ Git - fluidbook-toolbox-quiz.git/commitdiff
wip #6593 @7:00
authorsoufiane <soufiane@cubedesigners.com>
Mon, 15 Jan 2024 17:36:24 +0000 (18:36 +0100)
committersoufiane <soufiane@cubedesigners.com>
Mon, 15 Jan 2024 17:36:24 +0000 (18:36 +0100)
js/quiz.screen.outro.js
style/105-outro.sass

index eb48c8e628d4130e7f3af136439168db84d91e2c..2935785f2a45317a007c5caab00ebfb4dcafe197 100644 (file)
@@ -199,14 +199,35 @@ QuizScreenOutro.prototype = {
         }
         $(".score-answers-review_container").show();
         let reviewList = this.quiz.question.getAll();
+        let reviewList2 = this.quiz.question.getAll();
         let status = this.quiz.score.questionStatus
+        let answersUser = this.quiz.score.answers;
+        let wrongIcon = getSpriteIcon("quiz-wrong");
+
+        console.log("reviewList2",reviewList2)
 
         reviewList = reviewList.map((c, i) => {
             return {
                 'question': c['question'],
                 'type': c['type'],
-                'correctAnswers': c['answers'].filter((c) => {
-                    return c['correct'] === 1
+                'correctAnswers': c['answers'].filter((c__,k) => {
+                    let answers = answersUser[i][k]
+                    if(c['type'] === "match") {
+                        answers = c['answers'][answersUser[i][k]]
+                    }else if(c['type'] === "multiple") {
+                        console.log("index k",k,"index answersUser",answersUser[i][k])
+                        answers = answersUser[i].includes(k)
+                    }
+                    return answers
+                }).map((c_,k_) => {
+                    if(c['type'] === "draganddrop") {
+                        c_['drop_area'] = answersUser[i][k_]
+                    }
+                    if(c['type'] === "match") {
+                        c_ = { ...c_ }; //shallow copy
+                        c_['proposition'] = c['answers'][answersUser[i][k_]]['proposition']
+                    }
+                    return c_
                 }),
                 'status': status[i].ok,
                 'data': c,
@@ -217,9 +238,11 @@ QuizScreenOutro.prototype = {
         for (var i in reviewList) {
             i = parseInt(i);
             let review = reviewList[i];
+            let htmlSpan = null
 
-            let correctAnswers = review.correctAnswers.length > 0 ? review.correctAnswers : review.data.answers
+            console.log("result",review)
 
+            let correctAnswers = review.correctAnswers.length > 0 ? review.correctAnswers : review.data.answers
 
             let titleType = '';
             if (review.type === "draganddrop") {
@@ -232,11 +255,16 @@ QuizScreenOutro.prototype = {
 
             if (review.type === "multiple") {
                 html += '<p class="question">' + review.question + '</p>';
+                html += '<div class="multiple-wrapper">'
                 for (var j in correctAnswers) {
+                    if(!parseInt(correctAnswers[j].correct)) {
+                        htmlSpan = `<span class="access nok">${wrongIcon}</span>`
+                    }
                     html += '<div class="card-holder">';
-                    html += '<p class="answer slot active">' + correctAnswers[j].answer + '</p>';
+                    html += '<p class="answer slot active">' + correctAnswers[j].answer + htmlSpan +'</p>';
                     html += '</div>';
                 }
+                html += '</div>'
             }
 
             if (review.type === "draganddrop") {
@@ -267,6 +295,7 @@ QuizScreenOutro.prototype = {
                 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="separate"></div>'
                     html += '<div class="match-item slot active"><p>' + correctAnswers[k].proposition + '</p></div>'
                     html += '</div>'
                 }
index 5691e79d9892a8827f3e431ebdaa423e051fe0d5..c6ffadde986f07235b0dc40304860caf863099e3 100644 (file)
         top: var(--space-21-66)
         //margin-left: 75px
 
+        & > .score-text
+            text-align: center
+            margin-top: 22px
+
         &.neutral
             .score-text
                 width: 100%
         .score-text
             transform: scale(0)
 
-    &-text
-        text-align: center
-        margin-top: 22px
-
     &-answers-review_container
         width: 61.11111%
 
     #anime-result
         transform: scale(1.7)
 
-    .area-container,
-    .match-wrapper
+    .area-container
         display: grid
         grid-template-columns: 2fr 2fr
+
+    .area-container,
+    .match-wrapper
         gap: 8px
 
     .match-container
         display: grid
         gap: 8px
 
+    .match-wrapper
+        display: flex
+        align-items: center
+        flex-wrap: wrap
+        flex-direction: row
+
+    .multiple-wrapper
+        +flex-config(false,false,column)
+        .card-holder
+            padding: 0
+            background: transparent
+        .slot
+            +flex-config(space-between)
+            background-color: rgba($texts-color,.08) !important
+
     .match-title,
     .area-title
         display: grid
         background-color: $neutral-color !important
         cursor: pointer
 
+    .match-item
+        flex: 1
+        border: 0
+
+    .separate
+        width: 32px
+        height: 2px
+        border-radius: 5px
+        +opacity(.24, background-color, $texts-color)
+
     #resume
         width: 100%
         max-width: 300px