Merge pull request #5920 from betagouv/fix-tdc-query
procedure: fix query for finding champs without stable_id
This commit is contained in:
commit
46377fb7d9
1 changed files with 6 additions and 3 deletions
|
@ -541,7 +541,10 @@ class Procedure < ApplicationRecord
|
|||
end
|
||||
|
||||
def populate_champ_stable_ids
|
||||
TypeDeChamp.where(procedure: self, stable_id: nil).find_each do |type_de_champ|
|
||||
TypeDeChamp
|
||||
.joins(:revisions)
|
||||
.where(procedure_revisions: { procedure_id: id }, stable_id: nil)
|
||||
.find_each do |type_de_champ|
|
||||
type_de_champ.update_column(:stable_id, type_de_champ.id)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue