Closed bell87 closed 7 years ago
seems to me that xAPI question tracking might well be able to take advantage of what was set up for SCORM 1.2 cmi.interaction tracking - AFAIK xAPI was deliberately designed to be extremely similar to SCORM specifically to make this easier (and because the existing data format works very well).
if you look in questionView.js you'll see there are abstract implementations of two functions: getResponseType
and getResponse
. All core question components have concrete implementations of these functions that are responsible for returning the right data for their implementation. So, for example, the matching question's getResponseType
function will return a value of ""matching"
; textInput's implementation will return "fill-in"
. The getResponse
function is responsible for returning the answer data in a relatively generic format appropriate to the response type.
There's also an event - questionView:recordInteraction
that will be broadcast if a question that's not specifically been excluded from interaction tracking gets answered - this allows the author to control for every individual question whether the user's response gets recorded or not. If you're not bothered about this level of control you can just use the change:_isInteractionComplete
event to be notified of when the question has been answered instead.
In spoor's AdaptStatefulSession
you'll see all of this brought together in the onQuestionRecordInteraction
event handler Lines 120 - 132 that pulls all of the relevant data together in a completely generic manner in just a few lines of code.
Have a look at what this code is doing because I think these functions should be generating data in a format that will let you handle xAPI interaction tracking without having such tightly-coupled code as there is above.
Closing this PR in light of the recent changes to the develop
branch which takes more of an approach as outlined above without the tight coupling.
Added a statement model for open text input. Open text input uses https://github.com/adlnet/xAPI-Spec/blob/master/xAPI.md#long-fill-in as an interaction type.
I've merged @ryanlynch7 's branch into this branch to try and avoid merge conflicts later.