Include autenticazione, progetti isolati, mail marketing HTML con SMTP, test A/B e editor WYSIWYG. Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
872 B
Ruby
20 lines
872 B
Ruby
namespace :matchlivetv do
|
|
desc "Svuota MatchLiveTV e importa il foglio Campagna 100"
|
|
task reset_campaign: :environment do
|
|
path = ENV["CAMPAIGN_CSV"].presence ||
|
|
Rails.root.join("db/data/matchlivetv_campagna_100.csv")
|
|
user = User.find_by(email: "admin@simplecrm.local") || User.find_by!(role: "admin")
|
|
project = Project.find_by!(code: "matchlivetv")
|
|
|
|
puts "File: #{path}"
|
|
result = CampaignImport::MatchlivetvLaunch.new(path: path, user: user, project: project, wipe: true).call
|
|
puts "Organizzazioni rimosse dal solo MatchLiveTV: #{result.wiped_organizations}"
|
|
puts "Società importate: #{result.imported}"
|
|
if result.errors.any?
|
|
puts "Errori: #{result.errors.size}"
|
|
result.errors.first(10).each { |err| puts " riga #{err[:line]} #{err[:name]}: #{err[:message]}" }
|
|
abort "Import incompleto"
|
|
end
|
|
end
|
|
end
|