gabrieldoty / simplify-scorm

Scorm 1.2 Javascript API
MIT License
230 stars 77 forks source link

User interactions not added to window.API_1484_11.cmi #41

Closed Lutie closed 3 years ago

Lutie commented 3 years ago

Hello, i'm using simplify-scorm to run our scorm courses (2004). This is working as excpected for the most part : We can display the course, we can progress, we can finish it. But no interactions are added to window.API_1484_11.cmi.interactions array and i can't explain why. I don't know if this is an error or a misinterpretation of the features or their use on my part... But suppose strongly it must be the possible so i'm asking for help.

Actually we add the simplify-scorm by calling it in our template as such : <script type="text/javascript" src="{{ asset('/scorm/templates/js/scormAPI.min.js') }}"></script>. Then, in another js file, we use it like this:

    scormAPI = window.API_1484_11

    // Initalize learner data
    scormAPI.cmi.learner_id = user_uuid
    scormAPI.cmi.learner_name = user_name
    if(scormData) {
        participation_data = JSON.parse(scormData)
        scormAPI.loadFromJSON(participation_data)
    }

    // Initialize handler
    scormAPI.on("Initialize", function() {
        console.log("Scorm Course Initialized with success")
    })

    // Commit handler
    scormAPI.on("Commit", function() {
        var progress = Math.round(scormAPI.cmi.progress_measure*100)
        var data = scormAPI.cmi.toJSON()

        console.log(`Scorm Course is committing progress ... (${progress}%)`)
        response = $.post(commit_url, {
            "data": data,
            "progress": progress
        }, "json")
    })

And it works, we got progression, we save it, etc... But interactions are never assigned and a simple console.log(scormAPI.cmi.interactions) within the commit function reveals nothing have been added to interactions array.

Simplify-scorm is meant to record interactions right ? And if not, where or how can i get them in order to record them myself ? Thank you in advance for your help !

xob commented 3 years ago

My first immediate guess would be that the course itself isn't saving interactions in the API. You can easily see everything the course is doing (or not doing) by enabling debugging, and watching the events in the console.

You can enable debugging with the following code: window.API_1484_11.apiLogLevel = 1;

If the course is indeed not saving interactions, then there is nothing the API can do. The course has to be modified and changed to record interactions.

Lutie commented 3 years ago

I have messages like GetValue or SetValue for session_time, suspended_data, those kind of things... But never for anything related to interactions. So if I understand correctly what you explained to me the course does not trigger these events and therefore the API can't do anything about it.

Thanks for the explanations !