diff --git a/app/controllers/cards/stagings_controller.rb b/app/controllers/cards/stagings_controller.rb index 714427ecf..bbf5b38a9 100644 --- a/app/controllers/cards/stagings_controller.rb +++ b/app/controllers/cards/stagings_controller.rb @@ -2,7 +2,13 @@ class Cards::StagingsController < ApplicationController include CardScoped def update - @card.change_stage_to @collection.workflow.stages.find(params[:stage_id]) + stage = @collection.workflow.stages.find(params[:stage_id]) + + if @card.considering? + @card.engage + end + + @card.change_stage_to(stage) render_card_replacement end end diff --git a/app/models/card/engageable.rb b/app/models/card/engageable.rb index 0a006fd79..ae0f795d7 100644 --- a/app/models/card/engageable.rb +++ b/app/models/card/engageable.rb @@ -56,6 +56,7 @@ module Card::Engageable reopen engagement&.destroy activity_spike&.destroy + update!(stage: nil) touch_last_active_at end end @@ -66,6 +67,9 @@ module Card::Engageable reopen engagement&.destroy create_engagement!(status:) + if status == "doing" && stage.blank? + update!(stage: collection.initial_workflow_stage) + end end end end diff --git a/app/views/cards/_container.html.erb b/app/views/cards/_container.html.erb index 09eb83d11..c131ace03 100644 --- a/app/views/cards/_container.html.erb +++ b/app/views/cards/_container.html.erb @@ -21,7 +21,7 @@ <%= render "cards/container/title", card: card %> <%= render "cards/display/perma/steps", card: card %> - <%= render "cards/stagings/stages", card: card if card.doing? %> + <%= render "cards/stagings/stages", card: card if card.open? %>