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

storeData(terminateCommit: boolean) has different / wrong return type #712

Open
drahkrub opened this issue Jul 17, 2024 · 3 comments
Open

Comments

@drahkrub
Copy link

drahkrub commented Jul 17, 2024

(but I'm not sure if this is perhaps intentional)

storeData(...) (https://github.com/jcputney/scorm-again/blob/master/src/Scorm12API.js#L269 and also in Scorm2004API.js) returns an object like

{
    result: global_constants.SCORM_TRUE,
    errorCode: 0,
}

received as return value from processHttpRequest(...) if lmsCommitUrl is set in settings.

If lmsCommitUrl is not set then global_constants.SCORM_TRUE is returned.

The latter leads to problems in terminate(...) and commit(...) where storeData(...) is called, because in

      returnValue = (typeof result !== 'undefined' && result.result) ?
      result.result : global_constants.SCORM_FALSE;

(from https://github.com/jcputney/scorm-again/blob/master/src/BaseAPI.js#L321C1-L322C54)

returnValue is always evaluated to global_constants.SCORM_FALSE, which means that terminate(...) and commit(...) return global_constants.SCORM_FALSE although there is no error.

In that case a scorm package can call LMSGetLastError() to get the error code and realize that there was no error - but we have scorm packages from one supplier that simply stop working and only display an error window "0: No error".

I had to patch scorm-again.js to make this scorm packages work.

One could say that the scorm packages from this provider do not behave correctly - but I think also scorm-again.js can do a better job in the case mentioned.

@drahkrub
Copy link
Author

just discovered #679 - essentially the same

Copy link
Contributor

github-actions bot commented Oct 9, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Oct 9, 2024
@jcputney
Copy link
Owner

jcputney commented Oct 9, 2024

@drahkrub I believe this should be resolved/no longer an issue in 2.0.0

@github-actions github-actions bot removed the Stale label Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants