From 3310b165489b10901f50a21e5689ef046251dbd9 Mon Sep 17 00:00:00 2001 From: alan-wu Date: Tue, 6 Sep 2022 15:40:56 +1200 Subject: [PATCH] Use dataset doi instead of name when processsing data. Fix an issue when updated is not defined in SciCrunch response. --- src/components/SidebarContent.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/SidebarContent.vue b/src/components/SidebarContent.vue index 9e68f3a2..bae06a8a 100644 --- a/src/components/SidebarContent.vue +++ b/src/components/SidebarContent.vue @@ -311,7 +311,7 @@ export default { } data.results.forEach(element => { // match the scicrunch result with algolia result - let i = this.results.findIndex(res=> res.name === element.name) + let i = this.results.findIndex(res => element.doi ? element.doi.includes(res.doi) : false ) // Assign scicrunch results to the object Object.assign(this.results[i], element) // Assign the attributes that need some processing @@ -322,7 +322,7 @@ export default { numberSubjects: element.subjectSize ? parseInt(element.subjectSize) : 0, - updated: element.updated[0].timestamp.split("T")[0], + updated: (element.updated && element.updated.length) > 0 ? element.updated[0].timestamp.split("T")[0] : "", url: element.uri[0], datasetId: element.dataset_identifier, datasetRevision: element.dataset_revision,