fix(dossier): fix preloader with champs outside of revision
This commit is contained in:
parent
fcb868c6a8
commit
fb07bdb8aa
1 changed files with 2 additions and 1 deletions
|
@ -63,7 +63,8 @@ class DossierPreloader
|
||||||
|
|
||||||
def load_etablissements(champs)
|
def load_etablissements(champs)
|
||||||
to_include = @includes_for_etablissement.dup
|
to_include = @includes_for_etablissement.dup
|
||||||
champs_siret = champs.filter(&:siret?)
|
# `champs.siret?` will delegate to type_de_champ; this is not what we want here
|
||||||
|
champs_siret = champs.filter { _1.type == 'Champs::SiretChamp' }
|
||||||
etablissements_by_id = Etablissement.includes(to_include).where(id: champs_siret.map(&:etablissement_id).compact).index_by(&:id)
|
etablissements_by_id = Etablissement.includes(to_include).where(id: champs_siret.map(&:etablissement_id).compact).index_by(&:id)
|
||||||
champs_siret.each do |champ|
|
champs_siret.each do |champ|
|
||||||
etablissement = etablissements_by_id[champ.etablissement_id]
|
etablissement = etablissements_by_id[champ.etablissement_id]
|
||||||
|
|
Loading…
Reference in a new issue