From 4bbdacbb93c1a153400aac1247aa478dafda8ab3 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Thu, 7 Nov 2024 10:24:09 +1300 Subject: [PATCH 1/2] Fix dataset contributor name bug for broken page --- pages/datasets/[datasetId].vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/datasets/[datasetId].vue b/pages/datasets/[datasetId].vue index 0158894..757421c 100644 --- a/pages/datasets/[datasetId].vue +++ b/pages/datasets/[datasetId].vue @@ -251,8 +251,8 @@ export default { ]) const datasetDetailsContributors = algoliaContributors?.map(contributor => { return { - firstName: contributor.first.name, - lastName: contributor.last.name, + firstName: contributor.first?.name, + lastName: contributor.last?.name, orcid: contributor.curie?.replace('ORCID:', '') } }) From 813fb99246666d219c392b7f35d3e93345e8e2a7 Mon Sep 17 00:00:00 2001 From: akhuoa Date: Thu, 7 Nov 2024 11:27:47 +1300 Subject: [PATCH 2/2] Filter dataset contributors without name --- pages/datasets/[datasetId].vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pages/datasets/[datasetId].vue b/pages/datasets/[datasetId].vue index 757421c..4eaa90e 100644 --- a/pages/datasets/[datasetId].vue +++ b/pages/datasets/[datasetId].vue @@ -249,7 +249,10 @@ export default { getOrganizationIds(algoliaIndex), getContributorsFromAlgolia(algoliaIndex, datasetId) ]) - const datasetDetailsContributors = algoliaContributors?.map(contributor => { + const filteredAlgoliaContributors = algoliaContributors.filter(contributor => + contributor.first || contributor.last + ) + const datasetDetailsContributors = filteredAlgoliaContributors?.map(contributor => { return { firstName: contributor.first?.name, lastName: contributor.last?.name, @@ -269,7 +272,7 @@ export default { name: propOr('', 'organizationName', datasetDetails) } ] - const contributors = algoliaContributors?.map(contributor => { + const contributors = filteredAlgoliaContributors?.map(contributor => { const sameAs = contributor.curie ? `http://orcid.org/${contributor.curie.replace('ORCID:', '')}` : null