cybercussion / SCOBot

SCORM API for Content. JavaScript library, QUnit tests and examples.
https://cybercussion.com
159 stars 34 forks source link

Updating an interaction #10

Closed bevdokimov closed 5 years ago

bevdokimov commented 6 years ago

Hi,

first of all, thank you for providing the SCOBot open-source, it's really a big helper.

I am using the SCOBot#setInteraction method to record question answers. I have a case in my project where I want to update only the timestamp(the time when the user starts working actively on the interaction). In the wiki section it is stated that one could send only the items that have updated(another great feature). Unfortunately, I get error messages stating that I have not set some items. I was assuming that the SCOBot would just write the timestamp in the existing interaction. Do I misunderstand what you have written in the wiki?

Thank you very much in advance for your time.

cybercussion commented 6 years ago

@bevdokimov thanks I'm glad its helped people get exposed to SCORM in a Open Source capacity.

So SCOBot from memory is detecting the latency for you.

Lets see if I can dig into the setInteraction method quick - You need a id for sure and the original timestamp is calculated based on a prior interaction to calculate the latency.

I took a look at some of the error handling here: https://github.com/cybercussion/SCOBot/blob/master/QUnit-Tests/js/scorm/SCOBot.js#L1361

Essentially you'd want to at minimum pass the proper types. Least the way I wrote it I assumed you'd be passing a interaction object as defined there (even empty arrays and data types) so you could populate the same object. If your familiar with say MongoDB you could upsert data against a object and this method doesn't appear to manage that least how I interpret your attempting to.

So maybe that will give you a bread crumb with example to at least have a Interaction object which I believe the main reason I did it like that was to maintain journaling. Least with some of the code I'm seeing there its testing to see if you are passing an Array and if not sending a log message that an array wasn't found. Thats not necessarily bad although flagged as a error. Its just letting you know (because it happens) you didn't specify it.

Also use SCOVerseer to evaluate your interaction data if you want to see if you are getting the result you are looking for. It may be working after all?

cybercussion commented 5 years ago

Closing this out. Let me know if you have any further issues or debugging needs.