diff --git a/controllers/wizard.rb b/controllers/wizard.rb index e2d5656f..a4403c89 100644 --- a/controllers/wizard.rb +++ b/controllers/wizard.rb @@ -22,7 +22,7 @@ class CustomWizard::WizardController < ::ApplicationController format.json do builder = CustomWizard::Builder.new(current_user, params[:wizard_id].underscore) builder_opts = {} - builder_opts[:reset] = params[:reset] if params[:reset] + builder_opts[:reset] = params[:reset] || builder.wizard.restart_on_revisit if builder.wizard.present? wizard = builder.build(builder_opts, params) diff --git a/lib/builder.rb b/lib/builder.rb index 26b4eec9..b51b6e00 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -78,8 +78,7 @@ class CustomWizard::Builder def build(build_opts = {}, params = {}) unless (@wizard.completed? && !@wizard.multiple_submissions && !@wizard.user.admin) || !@steps || !@wizard.permitted? - - reset_submissions if build_opts[:reset] || @wizard.restart_on_revisit + reset_submissions if build_opts[:reset] @steps.each do |step_template| @wizard.append_step(step_template['id']) do |step|