diff --git a/app/lib/recovery/exporter.rb b/app/lib/recovery/exporter.rb index f414df28a..3b681608b 100644 --- a/app/lib/recovery/exporter.rb +++ b/app/lib/recovery/exporter.rb @@ -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 diff --git a/app/models/dossier_preloader.rb b/app/models/dossier_preloader.rb index 2f541ad93..28cb4b769 100644 --- a/app/models/dossier_preloader.rb +++ b/app/models/dossier_preloader.rb @@ -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