Add reconsider command

This commit is contained in:
Jorge Manrubia
2025-06-25 15:18:42 +02:00
parent 1303dfb14e
commit 7c83952c2d
3 changed files with 37 additions and 0 deletions
+1
View File
@@ -11,6 +11,7 @@ class Command::Ai::Parser
def parse(query)
normalized_query = resolve_named_params_to_ids command_translator.translate(query)
build_composite_command_for normalized_query, query
end
+34
View File
@@ -0,0 +1,34 @@
class Command::Consider < Command
include Command::Cards
store_accessor :data, :statues_by_card_id
def title
"Move #{cards_description} to Considering"
end
def execute
statues_by_card_id = {}
transaction do
cards.find_each do |card|
statues_by_card_id[card.id] = { closed: card.closed?, doing: card.doing?, considering: card.considering? }
card.reconsider
end
update! statues_by_card_id: statues_by_card_id
end
end
def undo
transaction do
statues_by_card_id.each do |card_id, data|
if card = user.accessible_cards.find_by_id(card_id)
card.close if data["closed"]
card.engage if data["doing"]
card.reconsider if data["considering"]
end
end
end
end
end
+2
View File
@@ -31,6 +31,8 @@ class Command::Parser
Command::ClearFilters.new(params: filter.as_params)
when "/close"
Command::Close.new(card_ids: cards.ids, reason: combined_arguments)
when "/consider", "/reconsider"
Command::Consider.new(card_ids: cards.ids)
when "/do"
Command::Do.new(card_ids: cards.ids)
when "/insight"