fix(sentry/3139111475): clean up some "corrupted" data, some dossier still have depose_at nil while en_construction_at is set

This commit is contained in:
Martin 2022-05-13 15:59:46 +02:00 committed by mfo
parent 1434224dd0
commit 9798e268df

View file

@ -0,0 +1,17 @@
namespace :after_party do
desc 'Deployment task: fix_depose_at_nil_on_dossier_state_not_brouillon'
task fix_depose_at_nil_on_dossier_state_not_brouillon: :environment do
puts "Running deploy task 'fix_depose_at_nil_on_dossier_state_not_brouillon'"
# Put your task implementation HERE.
dossiers_with_depose_at_nil = Dossier.state_not_brouillon.where(depose_at: nil)
rake_puts "Number of dossiers not in brouillon without depose_at : #{dossiers_with_depose_at_nil.count}"
dossiers_with_depose_at_nil.update_all("depose_at = en_construction_at")
# 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: AfterParty::TaskRecorder.new(__FILE__).timestamp
end
end