From 9b0d77a7212b9c6d37b0687dbde6bd2915c9002a Mon Sep 17 00:00:00 2001 From: thomasmars Date: Sat, 19 Nov 2016 12:29:38 +0100 Subject: [PATCH] Check instanceof score as well to validate number. HFP-215 --- js/h5p.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/h5p.js b/js/h5p.js index 77f9f0e..ebc7870 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1637,7 +1637,8 @@ H5P.shuffleArray = function (array) { * Reported time consumption/usage */ H5P.setFinished = function (contentId, score, maxScore, time) { - if (typeof score === 'number' && H5PIntegration.postUserStatistics === true) { + var validScore = typeof score === 'number' || score instanceof Number; + if (validScore && H5PIntegration.postUserStatistics === true) { /** * Return unix timestamp for the given JS Date. *