From b4949c0d836c8bcda54afab7a97ca9fe91cf8419 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 28 Oct 2016 10:46:05 +0200 Subject: [PATCH 1/2] Don't store results if they have no score. HFP-173 (cherry picked from commit 516c70a) --- js/h5p.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 60cfdd4..65ec2e1 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1637,7 +1637,7 @@ H5P.shuffleArray = function (array) { * Reported time consumption/usage */ H5P.setFinished = function (contentId, score, maxScore, time) { - if (H5PIntegration.postUserStatistics === true) { + if (score && H5PIntegration.postUserStatistics === true) { /** * Return unix timestamp for the given JS Date. * From 426f51caa0ca7f4408cbaae4479620b904818fb4 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Fri, 28 Oct 2016 13:45:11 +0200 Subject: [PATCH 2/2] Check that score is a number before storing it to the database. HFP-173 (cherry picked from commit bae3145) --- js/h5p.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 65ec2e1..e6b4555 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1637,7 +1637,7 @@ H5P.shuffleArray = function (array) { * Reported time consumption/usage */ H5P.setFinished = function (contentId, score, maxScore, time) { - if (score && H5PIntegration.postUserStatistics === true) { + if (typeof score === 'number' && H5PIntegration.postUserStatistics === true) { /** * Return unix timestamp for the given JS Date. *