Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

have spoor overwrite the hard-coded 'learner info' data with real data #155

Merged
merged 5 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ When **Spoor** is installed, *scorm_test_harness.html* can be used instead of *i
Currently (officially) only supports SCORM 1.2

----------------------------
**Version number:** 2.0.15 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
**Framework versions:** 2.0.15
**Version number:** 2.0.16 <a href="https://community.adaptlearning.org/" target="_blank"><img src="https://github.com/adaptlearning/documentation/blob/master/04_wiki_assets/plug-ins/images/adapt-logo-mrgn-lft.jpg" alt="adapt learning logo" align="right"></a>
**Framework versions:** 2.0.16
**Author / maintainer:** Adapt Core Team with [contributors](https://github.com/adaptlearning/adapt-contrib-spoor/graphs/contributors)
**Accessibility support:** n/a
**RTL support:** n/a
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adapt-contrib-spoor",
"version": "2.0.15",
"version": "2.0.16",
"framework": "^2.0.16",
"homepage": "https://github.com/adaptlearning/adapt-contrib-spoor",
"issues": "https://github.com/adaptlearning/adapt_framework/issues/new?title=contrib-spoor%3A%20please%20enter%20a%20brief%20summary%20of%20the%20issue%20here&body=please%20provide%20a%20full%20description%20of%20the%20problem,%20including%20steps%20on%20how%20to%20replicate,%20what%20browser(s)/device(s)%20the%20problem%20occurs%20on%20and,%20where%20helpful,%20the%20contents%20of%20the%20SCORM%20debug%20window.",
Expand Down
16 changes: 16 additions & 0 deletions js/adapt-stateful-session.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ define([
//Session Begin
initialize: function(callback) {
this._onWindowUnload = _.bind(this.onWindowUnload, this);

this.getConfig();

this.getLearnerInfo();

// restore state asynchronously to prevent IE8 freezes
this.restoreSessionState(_.bind(function() {
// still need to defer call because AdaptModel.check*Status functions are asynchronous
Expand All @@ -35,6 +39,18 @@ define([
}
},

/**
* replace the hard-coded _learnerInfo data in _globals with the actual data from the LMS
* if the course has been published from the AT, the _learnerInfo object won't exist so we'll need to create it
*/
getLearnerInfo: function() {
var globals = Adapt.course.get('_globals');
if (!globals._learnerInfo) {
globals._learnerInfo = {};
}
_.extend(globals._learnerInfo, Adapt.offlineStorage.get("learnerinfo"));
},

saveSessionState: function() {
var sessionPairs = this.getSessionState();
Adapt.offlineStorage.set(sessionPairs);
Expand Down
6 changes: 4 additions & 2 deletions required/offline_API_wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var API = {
if (!API.LMSFetch()) {
this.data["cmi.core.lesson_status"] = "not attempted";
this.data["cmi.suspend_data"] = "";
this.data["cmi.core.student_name"] = "Test Student";
this.data["cmi.core.student_name"] = "Surname, Sam";
this.data["cmi.core.student_id"] = "[email protected]";
this.data["cmi.interactions._count"] = 0;
API.LMSStore(true);
}
Expand Down Expand Up @@ -97,7 +98,8 @@ var API_1484_11 = {
if (!API_1484_11.LMSFetch()) {
this.data["cmi.completion_status"] = "not attempted";
this.data["cmi.suspend_data"] = "";
this.data["cmi.learner_name"] = "Test Student";
this.data["cmi.learner_name"] = "Surname, Sam";
this.data["cmi.learner_id"] = "[email protected]";
this.data["cmi.interactions._count"] = 0;
API_1484_11.LMSStore(true);
}
Expand Down