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

rollback and reset answers #57

Open
Diabz opened this issue Jul 10, 2019 · 3 comments
Open

rollback and reset answers #57

Diabz opened this issue Jul 10, 2019 · 3 comments

Comments

@Diabz
Copy link

Diabz commented Jul 10, 2019

Hi,
Thank you for sharing your work, your plugin is very cool and pleasant to use !

I have a bug when rollbacking to the first question fork and choosing another answer, the "new choice" is not stored and I'm stuck in the loop of the "first time choice"
Is it possible to rollback to the first question and reseting all the old answers stored ?

I know you're very busy at the moment but really apreciate if you can help me with that.
Thanks a lot !

@ekunitsa
Copy link

Also stuck on this problem :(

@pjammula
Copy link

We may leverage data-callback option on a question to cache and then reset state and answers.

<option name="firstQuestion" data-callback="cacheState">
<option name="resetQuestion" data-callback="rollback">

var rollbackTo = false;
var rollbackAnswers  = false;
function cacheState(stateWrapper, ready) {
  rollbackTo = stateWrapper.current;
  rollbackAnswers = { ...stateWrapper.answers };
}
function rollback(stateWrapper, ready) {
  if(rollbackTo) {
    stateWrapper.current.next = rollbackTo;
    stateWrapper.answers = { ...rollbackAnswers};
  }
}

@hugodemenez
Copy link

Hello, I am on the same issue. Have you found any workaround ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants