-
Notifications
You must be signed in to change notification settings - Fork 249
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
xapi trackable state saving + restoring on models #1523
Comments
|
I've made the libraries @moloko suggested to tidy up the default inheritance and copy calls. They're located at: Further reading at: To extend defaults and trackable would now look like this: var AdaptModel = Backbone.Model.extend({
defaults: {
_canShowFeedback: true,
_classes: "",
_canReset: false,
_isComplete: false,
_isInteractionComplete: false,
_requireCompletionOf: -1,
_isEnabled: true,
_isResetOnRevisit: false,
_isAvailable: true,
_isOptional: false,
_isReady: false,
_isVisible: true,
_isLocked: false
},
trackable: [
'_id',
'_isComplete',
'_isInteractionComplete'
]
}); var ComponentModel = AdaptModel.extend({
trackable: AdaptModel.resultExtend("trackable", [
'_userAnswer'
])
}); var QuestionModel = ComponentModel.extend({
// Used to set model defaults
defaults: function() {
// Extend from the ComponentModel defaults
return ComponentModel.resultExtend("defaults", {
_isQuestionType: true,
_shouldDisplayAttempts: false,
_canShowModelAnswer: true,
_canShowFeedback: true,
_canShowMarking: true,
_questionWeight: Adapt.config.get("_questionWeight"),
});
},
// Extend from the ComponentModel trackable
trackable: ComponentModel.resultExtend("trackable", [
'_isSubmitted',
'_score',
'_isCorrect',
'_attemptsLeft'
])
}); |
Regarding the change to the tracking ID values and the associated grunt task, how about if we just add a suffix to the tracking numbers for components? For example, if a block has a This could maintain backwards compatibility for SCORM tracking at the block level. |
We would need to keep the running count for each block, a It might be more work to do 19.1, 19.2 etc than to move them up one? |
I've updated the comments above to reflect the implementation ^ |
That's a good point about the count per block, I was thinking (selfishly) of the authoring tool. |
After a conversation, Brian and I agreed that |
I think the PR is ready to roll @brian-learningpool #1524 I would say, instead of having xapi record all the states by iterating through the models, you should probably listen to var restoreModel = Adapt.findById(stateObject._id);
if (!restoreModel) continue;
restoreModel.setTrackableState(stateObject); |
trackable
model value / function returning an array of trackable properties - flat, no hierarchygetTrackableState()
model function returns current model state as json filtered bytrackable
setTrackableState(state)
model function restores model state as filtered bytrackable
, rejecting data which doesn't matchtriggerTrackableState()
model function performs anAdapt.trigger("state:change", this.getTrackableState());
"state:change"
will trigger batched and debounced when the model changes so as not to interfere with existing codeThe text was updated successfully, but these errors were encountered: