fix(20220614053743_fix_procedure_presentation_with_depose_since): missed case of procedure_presentation with Mis à jour depuis

This commit is contained in:
Martin 2022-06-14 16:05:52 +02:00 committed by mfo
parent 4c5c459d6c
commit 4ef2fe37e6

View file

@ -0,0 +1,30 @@
namespace :after_party do
desc 'Deployment task: fix_procedure_presentation_with_updated_since'
task fix_procedure_presentation_with_updated_since: :environment do
puts "Running deploy task 'fix_procedure_presentation_with_updated_since'"
# Put your task implementation HERE.
errored_presentation = {
'label' => "Mis à jour depuis",
'table' => "self",
'column' => "updated_since",
'classname' => ""
}
procedures_presentations = ProcedurePresentation.where("displayed_fields @> ?", [errored_presentation].to_json)
progress = ProgressReport.new(procedures_presentations.size)
procedures_presentations.find_each do |procedure_presentation|
procedure_presentation.displayed_fields.delete_if do |field|
['updated_since', 'updated_since'].include?(field['column'])
end
procedure_presentation.save
progress.inc
end
progress.finish
# 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