Merge pull request #7468 from betagouv/fix-procedure-presentation-with-updated-since
fix(20220614053743_fix_procedure_presentation_with_depose_since): missed case of procedure_presentation with Mis à jour depuis
This commit is contained in:
commit
f216ca5a48
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