Skip to content

Commit

Permalink
fixed bug with role and type add and edit throwing error with descrip…
Browse files Browse the repository at this point in the history
…tion.name being null
  • Loading branch information
danielfang97 committed Feb 23, 2024
1 parent d3bd540 commit d8e74c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions lib/role.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}
}

Expand Down
6 changes: 4 additions & 2 deletions lib/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down

0 comments on commit d8e74c7

Please sign in to comment.