From 6518fd865f9ce7f83e973c385a7f55242e95a7ff Mon Sep 17 00:00:00 2001
From: Baptiste Toulemonde <toulemonde@cines.fr>
Date: Fri, 16 Sep 2022 15:12:08 +0200
Subject: [PATCH] fix

---
 src/app/stats/stats.component.ts | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/app/stats/stats.component.ts b/src/app/stats/stats.component.ts
index 04a0ff8e2..c72b29ad2 100644
--- a/src/app/stats/stats.component.ts
+++ b/src/app/stats/stats.component.ts
@@ -94,10 +94,16 @@ export class StatsComponent implements OnInit {
     }
 
   getTitleFromFdpApi(fdpApiResponse: MetaModel): string {
+    let title = '';
     if (fdpApiResponse) {
-      return Object.values(fdpApiResponse.path)[1]['title'];
+      Object.values(fdpApiResponse.path).forEach(e => {
+          if ( e.parent !== null) {
+            title = e.title;
+          }
+        }
+      );
     }
-    return '';
+    return title;
   }
 
   getCountDatasetByCatalog(fdpApiResponse: MetaModel): number {
-- 
GitLab