From fa40dd43ce04c49ed6bb05f41080fab75238cff2 Mon Sep 17 00:00:00 2001 From: andreiggr Date: Thu, 3 Nov 2022 11:40:48 +0200 Subject: [PATCH] dont add core metadata to csv if not defined --- src/ConnectedChart2/Download.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ConnectedChart2/Download.jsx b/src/ConnectedChart2/Download.jsx index 4a6cda73..fb0fbc02 100644 --- a/src/ConnectedChart2/Download.jsx +++ b/src/ConnectedChart2/Download.jsx @@ -176,8 +176,12 @@ const Download = (props) => { array[index][key] = item; }); }); + const hasCoreMetadata = + core_metadata?.data_provenance?.length > 0 || + core_metadata?.other_organisation?.length > 0 || + core_metadata?.temporal_coverage?.length > 0; - if (include_core_metadata_download) { + if (include_core_metadata_download && hasCoreMetadata) { const maxRowsMappedData = Object.values(mappedData).reduce((a, b) => a.length > b.length ? a : b, ).length;