]> _ Git - fluidbook-toolbox.git/commitdiff
wip #4031 @0:40
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 14:21:12 +0000 (15:21 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 14:21:12 +0000 (15:21 +0100)
app/Models/Quiz.php
resources/quiz/js/main.js

index cadee935922ae0c2de577257c45cb040c3fe4a68..39e9634743054a0c5bf926836051fffd90a9a6b7 100644 (file)
@@ -142,7 +142,17 @@ class Quiz extends CubistMagicAbstractModel
         $this->addField(['name' => 'review',
             'label' => 'Enable answer review',
             'hint' => 'Let the user review his answers and the correct ones at the end of the quiz',
-            'type' => 'Checkbox',
+            'type' => 'SelectFromArray',
+            'allows_null' => false,
+            'options' => [
+                'always' => 'Always',
+                'passed' => 'Only if passed',
+                'never' => 'Never',
+            ],
+            'options_aliases' => [
+                '1' => 'always',
+                '0' => 'never',
+            ],
             'default' => true,
             'tab' => 'Settings']);
 
index de4c64e1a2fc614778f6bb04848b6d86f745ff5f..7a7407eccd8b14154c9ee8bcea6a75cedfdc0200 100644 (file)
@@ -87,7 +87,7 @@
             cssVars({});
 
             var rev = $(data).find('review');
-            showReview = (rev.length === 0 || rev.text() === '1');
+            showReview = rev.text();
             threshold = 0;
             instantReview = $(data).find('instantReview').text() === '1';
             logAttempts = $(data).find('logattempts').text() === '1';
             }
 
             if ($(next).is("#resultsscreen")) {
-                if (showReview) {
-                    $('#correction').show();
-                } else {
+                var show = showReview === 'always' || (showReview === 'passed' && checkScore());
+                if (show) {
                     $('#correction').hide();
+                } else {
+                    $('#correction').show();
                 }
                 completed();
             }
 
         function displayBadge(correct) {
             resize();
-            if (!instantReview || correct===null) {
+            if (!instantReview || correct === null) {
                 nextScreen();
                 return;
             }