From 38432afc426f4e96c029b8146514411b3d59ee71 Mon Sep 17 00:00:00 2001 From: Daryl Hedley Date: Thu, 2 Apr 2015 15:41:19 +0100 Subject: [PATCH] Adds a defer to setting the components to complete fixes #59 --- bower.json | 2 +- js/serialisers/default.js | 14 +++++++++----- package.json | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/bower.json b/bower.json index 00a8bccd..817d9a41 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "adapt-contrib-spoor", - "version": "1.1.8", + "version": "1.1.9", "homepage": "https://github.com/adaptlearning/adapt-contrib-spoor", "authors": [ "Kevin Corry ", diff --git a/js/serialisers/default.js b/js/serialisers/default.js index 15a79ca2..e6570ab7 100644 --- a/js/serialisers/default.js +++ b/js/serialisers/default.js @@ -49,12 +49,16 @@ define(['coreJS/adapt'], function (Adapt) { deserialise: function (data) { var suspendData = JSON.parse(data); + + _.defer(_.bind(function() { - _.each(this.deserialiseSaveState(suspendData.spoor.completion), function(state, blockTrackingId) { - if (state === 1) { - this.markBlockAsComplete(Adapt.blocks.findWhere({_trackingId: blockTrackingId})); - } - }, this); + _.each(this.deserialiseSaveState(suspendData.spoor.completion), function(state, blockTrackingId) { + if (state === 1) { + this.markBlockAsComplete(Adapt.blocks.findWhere({_trackingId: blockTrackingId})); + } + }, this); + + }, this)); Adapt.course.set('_isComplete', suspendData.spoor._isCourseComplete); Adapt.course.set('_isAssessmentPassed', suspendData.spoor._isAssessmentPassed); diff --git a/package.json b/package.json index f3e92ecd..add587f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "adapt-contrib-spoor", - "version": "1.1.8", + "version": "1.1.9", "description": "A basic scorm tracking plugin for Adapt", "main": "", "scripts": {