diff --git a/app/views/cards/triage/_columns.html.erb b/app/views/cards/triage/_columns.html.erb
index 497629094..d7f556848 100644
--- a/app/views/cards/triage/_columns.html.erb
+++ b/app/views/cards/triage/_columns.html.erb
@@ -2,12 +2,15 @@
<%= button_to "Not now", card_not_now_path(card),
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.postponed? } ],
form_class: "flex align-center gap-half" %>
+
<%= button_to "The Stream", card_triage_path(card), method: :delete,
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.awaiting_triage? } ],
form_class: "flex align-center gap-half" %>
+
<% card.collection.columns.each do |column| %>
<%= button_to_set_column card, column %>
<% end %>
+
<%= button_to "Closed", card_closure_path(card, reason: "Completed"),
class: [ "btn justify-start workflow-stage txt-uppercase", { "workflow-stage--current": card.closed? } ],
form_class: "flex align-center gap-half" %>
diff --git a/script/migrations/populate_columns_from_workflow_stages.rb b/script/migrations/populate_columns_from_workflow_stages.rb
index e17ee791b..ce21ef792 100755
--- a/script/migrations/populate_columns_from_workflow_stages.rb
+++ b/script/migrations/populate_columns_from_workflow_stages.rb
@@ -2,9 +2,27 @@
require_relative "../../config/environment"
+class Card
+ has_one :engagement, dependent: :destroy, class_name: "Card::Engagement"
+
+ def doing?
+ open? && published? && engagement&.status == "doing"
+ end
+
+ def on_deck?
+ open? && published? && engagement&.status == "on_deck"
+ end
+
+ def considering?
+ open? && published? && engagement.blank?
+ end
+end
+
ApplicationRecord.with_each_tenant do |tenant|
puts "Processing tenant: #{tenant}"
+ Column.destroy_all
+
Collection.find_each do |collection|
next unless collection.workflow.present?
@@ -23,7 +41,7 @@ ApplicationRecord.with_each_tenant do |tenant|
# Associate cards with their corresponding columns based on stages
collection.cards.includes(:stage).find_each do |card|
- next unless card.stage.present?
+ next if !card.doing? || card.stage.present?
unless card.stage.workflow.collections.include?(collection)
puts "Corrupt data: the card with id #{card.id} has the stage #{card.stage.name} with id #{card.stage.id} that belongs to a workflow not asociated ot its collection"