2018-12-19 13:34:01 +01:00
|
|
|
namespace :after_party do
|
|
|
|
desc 'Deployment task: fix_email_templates_subjects'
|
|
|
|
task fix_email_templates_subjects: :environment do
|
2019-10-08 16:54:23 +02:00
|
|
|
rake_puts "Running deploy task 'fix_email_templates_subjects'"
|
2018-12-19 13:34:01 +01:00
|
|
|
|
|
|
|
klasses = [
|
|
|
|
Mails::ClosedMail,
|
|
|
|
Mails::InitiatedMail,
|
|
|
|
Mails::ReceivedMail,
|
|
|
|
Mails::RefusedMail,
|
|
|
|
Mails::WithoutContinuationMail
|
|
|
|
]
|
|
|
|
|
|
|
|
klasses.each do |klass|
|
|
|
|
klass
|
|
|
|
.where("subject LIKE '%--libellé procédure--%'")
|
|
|
|
.each do |instance|
|
|
|
|
|
|
|
|
instance.update(subject: instance.subject.gsub("--libellé procédure--", "--libellé démarche--"))
|
2018-12-24 17:43:12 +01:00
|
|
|
rake_puts "Subject mis-à-jour pour #{klass}##{instance.id}"
|
2018-12-19 13:34:01 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Update task as completed. If you remove the line below, the task will
|
|
|
|
# run with every deploy (or every time you call after_party:run).
|
|
|
|
AfterParty::TaskRecord.create version: '20181219122438'
|
|
|
|
end # task :fix_email_templates_subjects
|
|
|
|
end # namespace :after_party
|