From a9c6ee9dc3c791f39e732f21ffd119026630128a Mon Sep 17 00:00:00 2001
From: Martial Maillot <martial.maillot@gmail.com>
Date: Wed, 3 Apr 2024 10:42:44 +0200
Subject: [PATCH] =?UTF-8?q?fix(export):=20correctif=20rapide=20pour=20la?=
 =?UTF-8?q?=20mise=20en=20prod=20des=20donn=C3=A9es=20(#1349)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../src/ingester/cdtnDocuments.ts             | 28 +++++++++----------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/targets/export-elasticsearch/src/ingester/cdtnDocuments.ts b/targets/export-elasticsearch/src/ingester/cdtnDocuments.ts
index 6bff5c8ea..d2113de3f 100644
--- a/targets/export-elasticsearch/src/ingester/cdtnDocuments.ts
+++ b/targets/export-elasticsearch/src/ingester/cdtnDocuments.ts
@@ -78,20 +78,6 @@ export async function cdtnDocumentsGen(
     );
   };
 
-  logger.info("=== Editorial contents ===");
-  const documents = await getDocumentBySource<EditorialContentDoc>(
-    SOURCES.EDITORIAL_CONTENT,
-    getBreadcrumbs
-  );
-  const {
-    documents: editorialContents,
-    relatedIdsDocuments: relatedIdsEditorialDocuments,
-  } = await generateEditorialContents(documents, addGlossary);
-  documentsCount = {
-    ...documentsCount,
-    [SOURCES.EDITORIAL_CONTENT]: editorialContents.length,
-  };
-
   logger.info("=== Courriers ===");
   const modelesDeCourriers = await getDocumentBySource(
     SOURCES.LETTERS,
@@ -390,6 +376,20 @@ export async function cdtnDocumentsGen(
   };
   await updateDocs(SOURCES.CDT, cdtDoc);
 
+  logger.info("=== Editorial contents ===");
+  const documents = await getDocumentBySource<EditorialContentDoc>(
+    SOURCES.EDITORIAL_CONTENT,
+    getBreadcrumbs
+  );
+  const {
+    documents: editorialContents,
+    relatedIdsDocuments: relatedIdsEditorialDocuments,
+  } = await generateEditorialContents(documents, addGlossary);
+  documentsCount = {
+    ...documentsCount,
+    [SOURCES.EDITORIAL_CONTENT]: editorialContents.length,
+  };
+
   logger.info("=== Merge Related Documents ===");
   const allDocuments = [
     ...editorialContents,