refactor: DossierPreloader rename includes_for_dossier -> includes_for_champ

This commit is contained in:
simon lehericey 2024-05-15 10:49:27 +02:00
parent e8a175d310
commit 080bcd8628
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ module Recovery
etablissement: :exercices,
revision: :procedure)
@dossiers = DossierPreloader.new(dossier_with_data,
includes_for_dossier: [:geo_areas, etablissement: :exercices],
includes_for_champ: [:geo_areas, etablissement: :exercices],
includes_for_etablissement: [:exercices]).all
@file_path = file_path
end

View file

@ -1,10 +1,10 @@
class DossierPreloader
DEFAULT_BATCH_SIZE = 2000
def initialize(dossiers, includes_for_dossier: [], includes_for_etablissement: [])
def initialize(dossiers, includes_for_champ: [], includes_for_etablissement: [])
@dossiers = dossiers
@includes_for_etablissement = includes_for_etablissement
@includes_for_dossier = includes_for_dossier
@includes_for_champ = includes_for_champ
end
def in_batches(size = DEFAULT_BATCH_SIZE)
@ -37,7 +37,7 @@ class DossierPreloader
end
def load_dossiers(dossiers, pj_template: false)
to_include = @includes_for_dossier.dup
to_include = @includes_for_champ.dup
to_include << [piece_justificative_file_attachments: :blob]
if pj_template