refactor: DossierPreloader rename includes_for_dossier -> includes_for_champ
This commit is contained in:
parent
e8a175d310
commit
080bcd8628
2 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ module Recovery
|
||||||
etablissement: :exercices,
|
etablissement: :exercices,
|
||||||
revision: :procedure)
|
revision: :procedure)
|
||||||
@dossiers = DossierPreloader.new(dossier_with_data,
|
@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
|
includes_for_etablissement: [:exercices]).all
|
||||||
@file_path = file_path
|
@file_path = file_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
class DossierPreloader
|
class DossierPreloader
|
||||||
DEFAULT_BATCH_SIZE = 2000
|
DEFAULT_BATCH_SIZE = 2000
|
||||||
|
|
||||||
def initialize(dossiers, includes_for_dossier: [], includes_for_etablissement: [])
|
def initialize(dossiers, includes_for_champ: [], includes_for_etablissement: [])
|
||||||
@dossiers = dossiers
|
@dossiers = dossiers
|
||||||
@includes_for_etablissement = includes_for_etablissement
|
@includes_for_etablissement = includes_for_etablissement
|
||||||
@includes_for_dossier = includes_for_dossier
|
@includes_for_champ = includes_for_champ
|
||||||
end
|
end
|
||||||
|
|
||||||
def in_batches(size = DEFAULT_BATCH_SIZE)
|
def in_batches(size = DEFAULT_BATCH_SIZE)
|
||||||
|
@ -37,7 +37,7 @@ class DossierPreloader
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_dossiers(dossiers, pj_template: false)
|
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]
|
to_include << [piece_justificative_file_attachments: :blob]
|
||||||
|
|
||||||
if pj_template
|
if pj_template
|
||||||
|
|
Loading…
Reference in a new issue