]> _ Git - fluidbook-toolbox.git/commitdiff
wait #4031 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 15:13:00 +0000 (16:13 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 2 Nov 2020 15:13:00 +0000 (16:13 +0100)
app/Http/Controllers/Admin/Operations/ImportOperation.php
app/Models/Quiz.php
resources/quiz/js/main.js

index 8ac5c263dfe7058225c7bb583242b22e8db6452f..1ba768b4957e5042dddc7dc3553786dd29ca8689 100644 (file)
@@ -34,7 +34,8 @@ trait ImportOperation
         $default = ['title' => '',
             'translation' => '1',
             'scorm' => '1',
-            'review' => '1',
+            'review' => 'always',
+            'instantReview' => '1',
             'threshold' => '0',
             'owner' => auth()->user()->id];
 
@@ -52,7 +53,7 @@ trait ImportOperation
             $z = new ZipArchive();
             $ok = $z->open($file);
             if ($ok !== true) {
-                Alert::warning('Unable to open '.$file)->flash();
+                Alert::warning('Unable to open ' . $file)->flash();
                 continue;
             }
 
@@ -60,7 +61,7 @@ trait ImportOperation
             $data = [];
             $datacontent = $z->getFromName('data.xml');
             if (!$datacontent || stripos($datacontent, '<quiz') === false) {
-                Alert::warning($file.' doesn\'t seem to be a valid quiz')->flash();
+                Alert::warning($file . ' doesn\'t seem to be a valid quiz')->flash();
                 continue;
             }
             $x = simplexml_load_string($datacontent, "SimpleXMLElement", LIBXML_NOERROR | LIBXML_ERR_NONE);
@@ -112,6 +113,11 @@ trait ImportOperation
             $questions = [];
             foreach ($xquestions as $xquestion) {
                 $q = [
+                    'type' => 'multiple',
+                    'count_for_score' => true,
+                    'report_label' => '',
+                    'placeholder' => '',
+                    'min_score' => 0,
                     'question' => (string)$xquestion->label,
                     'explaination' => (string)$xquestion->correction,
                     'multiple' => isset($xquestion['multiple']) ? (bool)$xquestion['multiple'] : false,
index 39e9634743054a0c5bf926836051fffd90a9a6b7..411d7adbd5c5766121ba804b0874aa8389423611 100644 (file)
@@ -238,7 +238,7 @@ class Quiz extends CubistMagicAbstractModel
         $xml->addChild('threshold', $data->get('threshold', '0') ?: '0');
         $xml->addChild('restart_button', $data->get('restart_button', '0') ? '1' : '0');
         $xml->addChild('instantReview', $data->get('instantReview', true) ? '1' : '0');
-        $xml->addChild('review', $data->get('review', true) ? '1' : '0');
+        $xml->addChild('review', $data->get('review', 'always'));
         $xml->addChild('logattempts', $data->get('logattempts', false) ? '1' : '0');
         $xt = $xml->addChild('translations');
         /** @var QuizTranslation $translation */
index fbc228d2e2f79207fc5f90f789b9aba31e8cd82e..77a9394f45d4e2007076da5311f1ce1cd045e005 100644 (file)
                 return;
             }
 
+
             if ($(next).is("#resultsscreen")) {
+                updateScore();
+                console.log(showReview, checkScore())
                 var show = showReview === 'always' || (showReview === 'passed' && checkScore());
+                console.log(showReview, checkScore(), show, score);
                 if (!show) {
                     $('#correction').hide();
                 } else {