Merge pull request #10469 from tchak/task-commune-codes-batch
chore(task): run commune code fix on all champs of a procedure
This commit is contained in:
commit
f2b3ffed5a
1 changed files with 4 additions and 3 deletions
|
@ -2,11 +2,12 @@
|
||||||
|
|
||||||
module Maintenance
|
module Maintenance
|
||||||
class BackfillCommuneCodeFromNameTask < MaintenanceTasks::Task
|
class BackfillCommuneCodeFromNameTask < MaintenanceTasks::Task
|
||||||
attribute :champ_ids, :string
|
attribute :procedure_id, :string
|
||||||
validates :champ_ids, presence: true
|
validates :procedure_id, presence: true
|
||||||
|
|
||||||
def collection
|
def collection
|
||||||
Champ.where(id: champ_ids.split(',').map(&:strip).map(&:to_i))
|
procedure = Procedure.find(procedure_id.strip.to_i)
|
||||||
|
Champs::CommuneChamp.where(dossier_id: procedure.dossiers.not_brouillon)
|
||||||
end
|
end
|
||||||
|
|
||||||
def process(champ)
|
def process(champ)
|
||||||
|
|
Loading…
Add table
Reference in a new issue