fix(after_party): check constant presence before processing

NameError: uninitialized constant TmpDossiersMigrateRevisionsJob

refs: #7032
This commit is contained in:
François Vantomme 2022-03-11 16:54:38 +01:00 committed by simon lehericey
parent a79a66647b
commit 6a6947c064

View file

@ -3,17 +3,23 @@ namespace :after_party do
task migrate_revisions: :environment do
puts "Running deploy task 'migrate_revisions'"
procedures = Procedure.with_discarded.where(draft_revision_id: nil)
progress = ProgressReport.new(procedures.count)
if defined?(TmpDossiersMigrateRevisionsJob)
procedures = Procedure.with_discarded.where(draft_revision_id: nil)
progress = ProgressReport.new(procedures.count)
puts "Processing procedures"
procedures.find_each do |procedure|
RevisionsMigration.add_revisions(procedure)
progress.inc
puts "Processing procedures"
procedures.find_each do |procedure|
RevisionsMigration.add_revisions(procedure)
progress.inc
end
progress.finish
TmpDossiersMigrateRevisionsJob.perform_later([])
else
puts "Skip deploy task."
end
progress.finish
TmpDossiersMigrateRevisionsJob.perform_later([])
# 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).