From 26168a4b57bd8ba72f7c9ca5fa29221fb0f30501 Mon Sep 17 00:00:00 2001 From: Daniel Thies Date: Thu, 5 Aug 2021 20:21:47 -0500 Subject: [PATCH] Add grade and completion to final xapi data fixes #56 --- library.json | 2 +- scripts/single-choice-set.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/library.json b/library.json index 0e8d8c8..fcde6f4 100644 --- a/library.json +++ b/library.json @@ -6,7 +6,7 @@ "author": "Joubel", "majorVersion": 1, "minorVersion": 11, - "patchVersion": 14, + "patchVersion": 15, "runnable": 1, "fullscreen": 0, "embedTypes": [ diff --git a/scripts/single-choice-set.js b/scripts/single-choice-set.js index 0dccb69..4abc211 100644 --- a/scripts/single-choice-set.js +++ b/scripts/single-choice-set.js @@ -747,6 +747,8 @@ H5P.SingleChoiceSet = (function ($, UI, Question, SingleChoice, SolutionView, Re var result = XApiEventBuilder.createResult() .score(self.getScore(), self.getMaxScore()) .duration(self.getTotalPassedTime()) + .completion(self.options.choices.length === self.currentIndex) + .success((100 * self.getScore() / self.options.choices.length) >= self.options.behaviour.passPercentage) .build(); // creates the definition object