diff --git a/app/models/ai/list_cards_tool.rb b/app/models/ai/list_cards_tool.rb index 531f67d2d..ec105ba73 100644 --- a/app/models/ai/list_cards_tool.rb +++ b/app/models/ai/list_cards_tool.rb @@ -70,6 +70,7 @@ class Ai::ListCardsTool < Ai::Tool def execute(**params) cards = Card .where(collection: user.collections) + .published .with_rich_text_description .includes(:stage, :creator, :assignees, :goldness, :collection) diff --git a/test/models/ai/list_cards_tool_test.rb b/test/models/ai/list_cards_tool_test.rb index dad13fb13..6cf9e5f54 100644 --- a/test/models/ai/list_cards_tool_test.rb +++ b/test/models/ai/list_cards_tool_test.rb @@ -33,15 +33,19 @@ class Ai::ListCardsToolTest < ActiveSupport::TestCase end test "execute when filtering by ids" do + creating_card = collections(:writebook).cards.create! creator: users(:kevin), status: :creating + drafted_card = collections(:writebook).cards.create! creator: users(:kevin), status: :drafted + cards = cards(:shipping, :logo) - card_ids = cards.pluck(:id) + visible_card_ids = cards.pluck(:id) + card_ids = visible_card_ids + [ creating_card.id, drafted_card.id ] response = @tool.execute(ids: card_ids.join(", ")) page = parse_paginated_response(response) record_ids = page[:records].map { |card| card["id"].to_i } - assert_equal 2, record_ids.count - assert_equal card_ids.sort, record_ids.sort + assert_equal visible_card_ids.count, record_ids.count + assert_equal visible_card_ids.sort, record_ids.sort end test "execute when filtering by collection_ids" do