From d8e74c7750b939d5243a4a17e5848a2e7805155a Mon Sep 17 00:00:00 2001 From: learner97 Date: Thu, 22 Feb 2024 17:57:54 -0700 Subject: [PATCH] fixed bug with role and type add and edit throwing error with description.name being null --- lib/role.js | 13 +++++++++---- lib/type.js | 6 ++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/role.js b/lib/role.js index 799b98fe3..d0bbb4503 100644 --- a/lib/role.js +++ b/lib/role.js @@ -34,26 +34,31 @@ function lookupRole (uri) { if (!uri.term && uri.indexOf(igemPrefix) === 0) { return { uri: uri, - term: uri.slice(igemPrefix.length) + term: uri.slice(igemPrefix.length), + description: { name: uri.slice(igemPrefix.length) } } } if (!uri.term && uri.lastIndexOf('#') >= 0 && uri.lastIndexOf('#') + 1 < uri.length) { return { uri: uri, - term: uri.slice(uri.lastIndexOf('#') + 1) + term: uri.slice(uri.lastIndexOf('#') + 1), + description: { name: uri.slice(uri.lastIndexOf('#') + 1) } } } if (!uri.term && uri.lastIndexOf('/') >= 0 && uri.lastIndexOf('/') + 1 < uri.length) { return { uri: uri, - term: uri.slice(uri.lastIndexOf('/') + 1) + term: uri.slice(uri.lastIndexOf('/') + 1), + description: { name: uri.slice(uri.lastIndexOf('/') + 1) } } } return { - uri: uri + uri: uri, + term: uri, + description: { name: uri } } } diff --git a/lib/type.js b/lib/type.js index ed3a131b6..60e718957 100644 --- a/lib/type.js +++ b/lib/type.js @@ -21,13 +21,15 @@ function lookupType (uri) { return { uri: uri, term: soTerm, - description: sequenceOntology[soTerm] + description: sequenceOntology[soTerm] ? sequenceOntology[soTerm] : { name: soTerm } } } } return { - uri: uri + uri: uri, + term: uri, + description: uri } }