From bd88f6ace62aa362914bf53d512f2ddf32548cb6 Mon Sep 17 00:00:00 2001 From: Angus McLeod Date: Thu, 2 Nov 2017 12:15:30 +0800 Subject: [PATCH] Value population bugfix --- lib/builder.rb | 2 +- lib/wizard.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/builder.rb b/lib/builder.rb index fab55f07..aa0e99d9 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -56,7 +56,7 @@ class CustomWizard::Builder params[:description] = f['description'] if f['description'] params[:key] = f['key'] if f['key'] - if @submissions.last + if @submissions.last && @wizard.unfinished? submission = @submissions.last params[:value] = submission[f['id']] if submission[f['id']] end diff --git a/lib/wizard.rb b/lib/wizard.rb index 1d35e077..f58b37b1 100644 --- a/lib/wizard.rb +++ b/lib/wizard.rb @@ -76,7 +76,7 @@ class CustomWizard::Wizard acting_user_id: @user.id, action: ::UserHistory.actions[:custom_wizard_step], context: @id, - ).distinct.order(:updated_at).first + ).distinct.order('updated_at DESC').first if most_recent last_finished_step = most_recent.subject