Skip to content

Commit

Permalink
Start step bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Nov 13, 2017
1 parent 75d4fca commit c490523
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ def append_step(step)
end

def start
if unfinished?
step_id = ::UserHistory.where(
if unfinished? && last_completed_step = ::UserHistory.where(
acting_user_id: @user.id,
action: ::UserHistory.actions[:custom_wizard_step],
context: @id,
subject: @steps.map(&:id)
).order("created_at").last.subject
).order("created_at").last

step_id = last_completed_step.subject
last_index = @steps.index { |s| s.id == step_id }
@steps[last_index + 1]
else
Expand Down

0 comments on commit c490523

Please sign in to comment.