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

issue/2747 Added questionModel attemptStates API #2748

Merged
merged 11 commits into from
Jul 21, 2020
Merged

Conversation

olivermartinfoster
Copy link
Contributor

@olivermartinfoster olivermartinfoster commented May 6, 2020

#2747

To keep the previous question attempt states for use in plugins.

Requires #192 spoor pr to be saved and restored across sessions.

Added

  • trackableType property throughout to list the type of the trackable attributes
  • questionModel.getAttemptState Returns the raw state of the component in a format for spoor to store
  • questionModel.getAttemptObject Returns a formatted state object which can be passed through to questionModel.set
  • questionModel.setAttemptObject Sets the current state of the component from a state object
  • questionModel.addAttemptObject Adds an attempt object to the attemptStates store
  • questionModel.getAttemptObjects Returns an array of the component attempt state objects
  • _spoor._tracking._shouldStoreAttempts to config.json
  • Question completion automatically adds a state object to the attempt state store

Testing

  • Add component 'c-60' mcq _isResetOnRevisit: "soft"
  • Keep attempting 'c-60'
  • Use the console to determine mcq attempts
var Adapt = require('core/js/adapt');
Adapt.findById('c-60').getAttemptObjects();
  • To see states restored across sessions use spoor pr #192
  • And enable _spoor._tracking._shouldStoreResponses and _spoor._tracking._shouldStoreAttempts in config.json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

@oliverfoster oliverfoster linked an issue May 12, 2020 that may be closed by this pull request
2 tasks
src/core/js/models/questionModel.js Outdated Show resolved Hide resolved
src/core/js/models/questionModel.js Outdated Show resolved Hide resolved
src/core/js/models/questionModel.js Show resolved Hide resolved
src/core/js/models/questionModel.js Outdated Show resolved Hide resolved
Copy link
Contributor

@tomgreenfield tomgreenfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, should be quite easy to also store incomplete question attempts by listening to a change of _isSubmitted.

@oliverfoster
Copy link
Member

oliverfoster commented May 27, 2020

I realised that the _userAnswers wasn't getting stored because the view is attached to change:_isSubmitted after the model and so the model would have to wait for the view to finish before saving the state. I've instead added a QuestionModel.prototype.onSubmitted function to complement the QuestionView.prototype.onSubmitted function called at the end of QuestionView.prototype.onSubmitClicked.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Contributor

@moloko moloko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code 👓

@oliverfoster
Copy link
Member

@tomgreenfield if you could re-review this one is ready to go in

Copy link
Contributor

@tomgreenfield tomgreenfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎈

@oliverfoster oliverfoster merged commit 034b873 into master Jul 21, 2020
@oliverfoster oliverfoster deleted the issue/2747 branch July 21, 2020 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

adapt_framework: store question attempt states
5 participants