Merge pull request #7318 from betagouv/sentry/3139111475

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:
mfo 2022-05-16 14:02:46 +02:00 committed by GitHub
commit 438c80d849
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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