From bdb375d9d715582077f177c74337d714d57ce96d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Thu, 31 Oct 2024 10:58:00 +0100 Subject: [PATCH] fix(charts): Correct graph if no agency --- .../general/impact-financement/get-data-taux-ouverture.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Charts/publications/general/impact-financement/get-data-taux-ouverture.js b/src/components/Charts/publications/general/impact-financement/get-data-taux-ouverture.js index a85e0c42..bd197e96 100644 --- a/src/components/Charts/publications/general/impact-financement/get-data-taux-ouverture.js +++ b/src/components/Charts/publications/general/impact-financement/get-data-taux-ouverture.js @@ -75,9 +75,11 @@ function useGetData(observationSnap, domain, split) { (item) => item?.terms?.['bso_local_affiliations.keyword'], ); query.query.bool.filter.splice(indexToDelete, 1); - queryFiltered.query.bool.filter.push({ - term: { 'grants.agency.keyword': agency }, - }); + if (agency) { + queryFiltered.query.bool.filter.push({ + term: { 'grants.agency.keyword': agency }, + }); + } queries.push(Axios.post(ES_API_URL, queryFiltered, HEADERS)); queries.push(Axios.post(ES_API_URL, query, HEADERS)); const res = await Axios.all(queries);