From: Vincent Vanwaelscappel Date: Tue, 10 Jul 2018 16:51:19 +0000 (+0200) Subject: wip #2048 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c476ff59f080627ccc151b4d7b2fd4f47237527b;p=fluidbook-html5.git wip #2048 @3 --- diff --git a/_imsmanifest.2004.xml b/_imsmanifest.2004.xml index 60e8b817..6c869515 100644 --- a/_imsmanifest.2004.xml +++ b/_imsmanifest.2004.xml @@ -20,14 +20,6 @@ $scorm_title $scorm_title - - - - - 0.5 - - - diff --git a/js/libs/fluidbook/fluidbook.scorm.js b/js/libs/fluidbook/fluidbook.scorm.js index 82572632..ac47b9bb 100644 --- a/js/libs/fluidbook/fluidbook.scorm.js +++ b/js/libs/fluidbook/fluidbook.scorm.js @@ -1,6 +1,7 @@ function FluidbookScorm(fluidbook) { this.fluidbook = fluidbook; this.linksToComplete = []; + this.manageScore = this.fluidbook.datas.scorm_score; this.init(); } diff --git a/js/libs/scorm/scorm.js b/js/libs/scorm/scorm.js index 641efbf9..7c99737e 100644 --- a/js/libs/scorm/scorm.js +++ b/js/libs/scorm/scorm.js @@ -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) {