Files
fizzy/app/models/card/promptable.rb
T
Mike Dalessio d41d50d52b Account.sole → Current.account
and some other de-tenant changes, including removing the controller
tenanting concerns
2025-11-17 09:11:40 -05:00

48 lines
1004 B
Ruby

module Card::Promptable
extend ActiveSupport::Concern
included do
include Rails.application.routes.url_helpers
end
def to_prompt
<<~PROMPT
BEGIN OF CARD #{id}
**Title:** #{title.first(1000)}
**Description:**
#{description.to_plain_text.first(10_000)}
#### Metadata
* Id: #{id}
* Created by: #{creator.name}}
* Assigned to: #{assignees.map(&:name).join(", ")}
* Column: #{column_prompt_label}
* Created at: #{created_at}}
* Board id: #{board_id}
* Board name: #{board.name}
* Number of comments: #{comments.count}
* Path: #{card_path(self, script_name: Current.account.slug)}
END OF CARD #{id}
PROMPT
end
private
def column_prompt_label
if open?
if postponed?
"Not now"
elsif triaged?
"#{column&.name}"
else
"Maybe?"
end
else
"Closed (by #{closed_by&.name} at #{closed_at})"
end
end
end