Merge pull request #5920 from betagouv/fix-tdc-query

procedure: fix query for finding champs without stable_id
This commit is contained in:
Paul Chavard 2021-03-04 11:05:35 +01:00 committed by GitHub
commit 46377fb7d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -541,9 +541,12 @@ class Procedure < ApplicationRecord
end
def populate_champ_stable_ids
TypeDeChamp.where(procedure: self, stable_id: nil).find_each do |type_de_champ|
type_de_champ.update_column(:stable_id, type_de_champ.id)
end
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
def missing_steps