fix(20220614053743_fix_procedure_presentation_with_depose_since): missed case of procedure_presentation with Mis à jour depuis
This commit is contained in:
parent
4c5c459d6c
commit
4ef2fe37e6
1 changed files with 30 additions and 0 deletions
|
@ -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
|
Loading…
Reference in a new issue