From 9cc57f7a0da931b175206b41fee179f35b8c5b14 Mon Sep 17 00:00:00 2001 From: Birdmachine Date: Fri, 4 Oct 2024 15:02:49 -0400 Subject: [PATCH] Fix for collections with contributors that lack an is_contact field --- src/src/components/collections/collections.jsx | 9 ++++++--- src/src/components/collections/epicollections.jsx | 10 ++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/src/components/collections/collections.jsx b/src/src/components/collections/collections.jsx index 5122fcd4..a4aeb5c7 100644 --- a/src/src/components/collections/collections.jsx +++ b/src/src/components/collections/collections.jsx @@ -520,10 +520,13 @@ export function CollectionForm (props){ var contributors = [] var contacts = [] for (const row of data.data) { - contributors.push(row) - if(row.is_contact === "TRUE"){ + if(!row.is_contact){ + row.is_contact = "NO" + }else if (row.is_contact && (row.is_contact === "TRUE"|| row.is_contact.toLowerCase()==="yes") ){ contacts.push(row) } + contributors.push(row) + } setFormValues ({ ...formValues, @@ -548,7 +551,7 @@ export function CollectionForm (props){ {row.display_name} {row.affiliation} {row.orcid} - {(row.is_contact==="TRUE" || row.is_contact.toLowerCase()==="yes") ? : ""} + { (row.is_contact && (row.is_contact==="TRUE" || row.is_contact.toLowerCase()==="yes")) ? : ""} ); }); diff --git a/src/src/components/collections/epicollections.jsx b/src/src/components/collections/epicollections.jsx index a7d62f4a..2ca032b0 100644 --- a/src/src/components/collections/epicollections.jsx +++ b/src/src/components/collections/epicollections.jsx @@ -528,10 +528,12 @@ export function EPICollectionForm (props){ var contacts = [] for (const row of data.data) { contributors.push(row) - if(row.is_contact === "TRUE"){ + if(!row.is_contact){ + row.is_contact = "NO" + }else if(row.is_contact && (row.is_contact === "TRUE"|| row.is_contact.toLowerCase()==="yes") ){ contacts.push(row) - console.debug('%c◉ contact ', 'color:#00ff7b', row); } + contributors.push(row) } setFormValues ({ ...formValues, @@ -556,8 +558,8 @@ export function EPICollectionForm (props){ {row.display_name} {row.affiliation} {row.orcid} - {(row.is_contact==="TRUE" || row.is_contact.toLowerCase()==="yes") ? : ""} - + { (row.is_contact && (row.is_contact==="TRUE" || row.is_contact.toLowerCase()==="yes")) ? : ""} + ); }); }