fix(landing-page): resolve rubocop offenses for ai syncable

This commit is contained in:
Rodrigo Borba 2026-03-03 22:25:19 -03:00
parent 7e23e59782
commit 46806fa635
2 changed files with 10 additions and 9 deletions

View File

@ -31,8 +31,16 @@ module LandingHostAiSyncable
article = find_or_initialize_faq_article
article.title = faq_article_title
article.content = generate_promotions_text(promos)
article.description = "FAQ Gerado automaticamente pela Landing Page: #{hostname}"
# Setting the author as the portal's account first user (just as a fallback) or we can use a system user
article.author ||= default_article_author
article.status = :published
# Generating the standard AI instruction text for the multiple promotions
article.save!
end
def generate_promotions_text(promos)
text = %(INSTRUÇÃO PARA A IA (PROMOÇÕES ATIVAS DO LINK #{hostname}):\n\n)
text += %(Existem promoções ativas para os leads que chegam pela landing page '#{hostname}'.\n)
text += %(Ofereça a promoção correspondente ao Canal/Origem pelo qual o cliente chegou.\n\n)
@ -47,13 +55,7 @@ module LandingHostAiSyncable
text += "\n"
end
article.content = text
article.description = "FAQ Gerado automaticamente pela Landing Page: #{hostname}"
# Setting the author as the portal's account first user (just as a fallback) or we can use a system user
article.author ||= default_article_author
article.status = :published
article.save!
text
end
def archive_faq_article

View File

@ -2,7 +2,6 @@ require 'rails_helper'
RSpec.describe LandingHost, type: :model do
let(:account) { create(:account) }
let!(:user) { create(:user, account: account) }
let(:portal) { create(:portal, account: account) }
let(:inbox) { create(:inbox, account: account, portal: portal) }