Relax conditions to match collections

This commit is contained in:
Jorge Manrubia
2025-05-15 18:12:31 +02:00
parent 6933449d2d
commit 096933d326
+1 -1
View File
@@ -44,7 +44,7 @@ class Command::Ai::Parser
if query_context = query_json["context"].presence
query_context["assignee_ids"] = query_context["assignee_ids"]&.filter_map { |name| assignee_from(name)&.id }
query_context["creator_id"] = assignee_from(query_context["creator_id"])&.id if query_context["creator_id"]
query_context["collection_ids"] = query_context["collection_ids"]&.filter_map { |name| Collection.where("lower(name) = ?", name.downcase).first&.id }
query_context["collection_ids"] = query_context["collection_ids"]&.filter_map { |name| Collection.where("lower(name) like ?", "%#{name.downcase}%").first&.id }
query_context["tag_ids"] = query_context["tag_ids"]&.filter_map { |name| ::Tag.find_by_title(name)&.id }
query_context.compact!
end