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

Update: Added a new maxCharLimitOverride property to allow override o… #287

Merged
merged 3 commits into from
Aug 23, 2023
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
6 changes: 5 additions & 1 deletion js/scorm/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ class ScormWrapper {
this.finishCalled = false;
this.logger = Logger.getInstance();
this.scorm = pipwerks.SCORM;
this.maxCharLimitOverride = null
/**
* Prevent the Pipwerks SCORM API wrapper's handling of the exit status
*/
Expand Down Expand Up @@ -146,6 +147,9 @@ class ScormWrapper {
if (_.isBoolean(settings._setCompletedWhenFailed)) {
this.setCompletedWhenFailed = settings._setCompletedWhenFailed;
}
if (!_.isNaN(settings._maxCharLimitOverride) && settings._maxCharLimitOverride > 0) {
this.maxCharLimitOverride = settings._maxCharLimitOverride;
}
}

this.logger.debug('ScormWrapper::initialize');
Expand Down Expand Up @@ -679,7 +683,7 @@ class ScormWrapper {

recordInteractionFillIn(id, response, correct, latency, type) {

const maxLength = this.isSCORM2004() ? 250 : 255;
const maxLength = this.maxCharLimitOverride ?? this.isSCORM2004() ? 250 : 255;

if (response.length > maxLength) {
response = response.substr(0, maxLength);
Expand Down
9 changes: 9 additions & 0 deletions properties.schema
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,15 @@
"validators": [],
"help": "If enabled, `cmi.completion_status` will be set to \"completed\" if the assessment is \"failed\". Only valid for SCORM 2004, where the logic for completion and success is separate."
},
"_maxCharLimitOverride": {
"type": "number",
"required": false,
"default": "0",
"title": "Override value for maximum character limit on fill-in type answers",
"inputType": "Number",
"validators": ["number"],
"help": "If your LMS allows it, you may set a value to override the default character limit for fill-in answers (250 for SCORM2004, 255 for SCORM1.2)."
},
"_connectionTest": {
"type": "object",
"required": true,
Expand Down
25 changes: 9 additions & 16 deletions schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,7 @@
"title": "SCORM version",
"description": "The SCORM standard to use - SCORM 1.2 or SCORM 2004 4th Edition",
"default": "1.2",
"enum": [
"1.2",
"2004"
],
"enum": ["1.2", "2004"],
"_backboneForms": "Select"
},
"_showDebugWindow": {
Expand Down Expand Up @@ -159,24 +156,14 @@
"type": "string",
"title": "Incomplete course exit status",
"default": "auto",
"enum": [
"auto",
"suspend",
"normal",
""
],
"enum": ["auto", "suspend", "normal", ""],
"_backboneForms": "Select"
},
"_exitStateIfComplete": {
"type": "string",
"title": "Complete course exit status",
"default": "auto",
"enum": [
"auto",
"suspend",
"normal",
""
],
"enum": ["auto", "suspend", "normal", ""],
"_backboneForms": "Select"
},
"_setCompletedWhenFailed": {
Expand All @@ -185,6 +172,12 @@
"description": "If enabled, `cmi.completion_status` will be set to \"completed\" if the assessment is \"failed\". Only valid for SCORM 2004, where the logic for completion and success is separate.",
"default": true
},
"_maxCharLimitOverride": {
"type": "number",
"title": "Override value for maximum character limit on fill-in type answers",
"description": "If your LMS allows it, you may set a value to override the default character limit for fill-in answers (250 for SCORM2004, 255 for SCORM1.2).",
"default": 0
},
"_connectionTest": {
"type": "object",
"title": "Connection Test",
Expand Down