From 5ab6ff142f1327d62963349a0e199cb8cbea0d9f Mon Sep 17 00:00:00 2001 From: "argiro.kokogiannaki" Date: Wed, 15 Apr 2020 14:31:01 +0000 Subject: [PATCH] [Library|Trunk] parsingFunctions: Add checks for relations (similar, supplumentary, etc) that have no type and title git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58496 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../landing-utils/parsingFunctions.class.ts | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index c1611ee5..a696e8c0 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -414,18 +414,23 @@ export class ParsingFunctions { class: "", provenanceAction: provenanceAction }; - if (relation['resulttype'].classname == "publication") { - researchResult['class'] = "publication"; - } else if (relation['resulttype'].classname == "dataset") { - researchResult['class'] = "dataset"; - } else if (relation['resulttype'].classname == "software") { - researchResult['class'] = "software"; - } else if (relation['resulttype'].classname == "other") { - researchResult['class'] = "other"; + if(relation['resulttype']) { + if (relation['resulttype'].classname == "publication") { + researchResult['class'] = "publication"; + } else if (relation['resulttype'].classname == "dataset") { + researchResult['class'] = "dataset"; + } else if (relation['resulttype'].classname == "software") { + researchResult['class'] = "software"; + } else if (relation['resulttype'].classname == "other") { + researchResult['class'] = "other"; + } } researchResult['id'] = relation['to'].content; - let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : relation['title'].content; + let titleName = Array.isArray(relation['title']) ? relation['title'][0].content : (relation['title']?relation['title'].content:null); researchResult['name'] = titleName; + if(!researchResult['name']) { + researchResult['name'] = "[no title available]"; + } if (relation.hasOwnProperty("dateofacceptance")) { var date: string = ((Array.isArray(relation.dateofacceptance)) ? (relation.dateofacceptance[0]) : (relation.dateofacceptance)) + ""; // transform to string in case it is an integer researchResult['date'] = (date && (date).indexOf('-') !== -1) ? date.split('-')[0] : date;