]> _ Git - fluidbook-html5.git/commitdiff
wip #2048 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 10 Jul 2018 16:51:19 +0000 (18:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 10 Jul 2018 16:51:19 +0000 (18:51 +0200)
_imsmanifest.2004.xml
js/libs/fluidbook/fluidbook.scorm.js
js/libs/scorm/scorm.js

index 60e8b817133d61b0eaf1298ad2c059f5dc977d18..6c8695153e0ed2b13e55a1d1fdd944efeaedd8fc 100644 (file)
             <title>$scorm_title</title>
             <item identifier="$scorm_id" identifierref="$scorm_id" isvisible="true">
                 <title>$scorm_title</title>
-                <imsss:sequencing>
-                    <imsss:objectives>
-                        <imsss:primaryObjective satisfiedByMeasure="true">
-                            <!-- equates to cmi.scaled_passing_score -->
-                            <imsss:minNormalizedMeasure>0.5</imsss:minNormalizedMeasure>
-                        </imsss:primaryObjective>
-                    </imsss:objectives>
-                </imsss:sequencing>
             </item>
         </organization>
     </organizations>
index 8257263278442c4f6bfc070b2e6ff659db412d50..ac47b9bb2f57baa6989b5d9e2a115ebda50ca322 100644 (file)
@@ -1,6 +1,7 @@
 function FluidbookScorm(fluidbook) {
     this.fluidbook = fluidbook;
     this.linksToComplete = [];
+    this.manageScore = this.fluidbook.datas.scorm_score;
     this.init();
 }
 
index 641efbf94f10300799e13a17609b1b8544fd0d64..7c99737ef46d18bcab094d437125cd96ccc3470b 100644 (file)
@@ -14,7 +14,7 @@ var _CMI12 = {
     'status': "cmi.core.lesson_status",
     'session_time': 'cmi.core.session_time',
     'success_status': '',
-    'exit':'cmi.core.exit',
+    'exit': 'cmi.core.exit',
 };
 
 var _CMI2004 = {
@@ -22,7 +22,7 @@ var _CMI2004 = {
     'status': 'cmi.completion_status',
     'session_time': 'cmi.session_time',
     'success_status': 'cmi.success_status',
-    'exit':'cmi.exit',
+    'exit': 'cmi.exit',
 }
 
 $(function () {
@@ -41,7 +41,7 @@ function initScorm() {
     }
     SCORM_INITED = true;
     pipwerks.SCORM.init();
-    pipwerks.SCORM.set('exit', 'suspend');
+    setScormValue('exit', 'suspend');
     startScormTimer();
     initScormEvents();
     initScormInteractions();
@@ -144,10 +144,10 @@ function initScormInteractions() {
             n++;
         }
     }
-    if (SCORM_WEIGHTING > 0) {
+    if (fluidbook.scorm.manageScore && SCORM_WEIGHTING > 0) {
         pipwerks.SCORM.set('cmi.score.min', '0');
         pipwerks.SCORM.set('cmi.score.max', SCORM_WEIGHTING);
-        SCORM_SUCCESS_SCORE = parseFloat(pipwerks.SCORM.get('cmi.scaled_passing_score'));
+        SCORM_SUCCESS_SCORE = parseFloat(fluidbook.datas.scorm_score_min) / 100;
 
         updateInteractionsScore();
     }
@@ -182,8 +182,10 @@ function defineScormInteraction(number, id, type, question, correct_response, we
     setScormValue('cmi.interactions.' + number + '.id', id);
     setScormValue('cmi.interactions.' + number + '.description', question);
     setScormValue('cmi.interactions.' + number + '.type', type);
-    setScormValue('cmi.interactions.' + number + '.correct_responses.0.pattern', correct_response);
-    setScormValue('cmi.interactions.' + number + '.weighting', weighting);
+    if (fluidbook.scorm.manageScore) {
+        setScormValue('cmi.interactions.' + number + '.correct_responses.0.pattern', correct_response);
+        setScormValue('cmi.interactions.' + number + '.weighting', weighting);
+    }
 
     SCORM_WEIGHTING += weighting;
 }
@@ -210,11 +212,14 @@ function answerScormInteraction(id, learner_response, result, set_latency) {
     var n = scormIdToN(id);
     var currentTime = Math.round(new Date().getTime() / 1000);
     var latency = getScormTimeInterval(SCORM_QUESTIONS[n].timestamp, new Date());
-    if (result === undefined) {
-        result = (learner_response === SCORM_QUESTIONS[n].correct_response);
+
+    if (fluidbook.scorm.manageScore) {
+        if (result === undefined) {
+            result = fluidbook.datas.scorm_quiz_as_questionnaire || (learner_response === SCORM_QUESTIONS[n].correct_response);
+        }
+        setScormValue('cmi.interactions.' + n + '.result', result ? 'correct' : 'incorrect');
     }
 
-    setScormValue('cmi.interactions.' + n + '.result', result ? 'correct' : 'incorrect');
     setScormValue('cmi.interactions.' + n + '.learner_response', learner_response);
     setScormValue('cmi.interactions.' + n + '.latency', latency);
 
@@ -222,6 +227,9 @@ function answerScormInteraction(id, learner_response, result, set_latency) {
 }
 
 function updateInteractionsScore() {
+    if (!fluidbook.scorm.manageScore) {
+        return;
+    }
     var score = 0;
     var answered = 0;
     $.each(SCORM_QUESTIONS, function (n, q) {