[Trunk | Library]: (Bug Fix) parsingFunctions.class.ts: In 'parseContexts()' method, there may exist multiple categories.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@56937 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-08-30 13:39:54 +00:00
parent b1110aca0d
commit 1bce72ccb4
1 changed files with 29 additions and 24 deletions

View File

@ -512,15 +512,19 @@ export class ParsingFunctions {
if(context.hasOwnProperty("type") && (context['type'] == "community" || context['type'] == "ri")) {
if(context.hasOwnProperty("category")) {
if(context['category'].hasOwnProperty("concept")) {
let category;
let length2 = Array.isArray(context['category']) ? context['category'].length : 1;
for (let z = 0; z < length2; z++) {
category = Array.isArray(context['category']) ? context['category'][z] : context['category'];
if (category.hasOwnProperty("concept")) {
let categoryConcept;
let length1 = Array.isArray(context['category']['concept']) ? context['category']['concept'].length : 1;
for(let j=0; j<length1; j++) {
categoryConcept = Array.isArray(context['category']['concept']) ? context['category']['concept'][j] : context['category']['concept'];
let length1 = Array.isArray(category['concept']) ? category['concept'].length : 1;
for (let j = 0; j < length1; j++) {
categoryConcept = Array.isArray(category['concept']) ? category['concept'][j] : category['concept'];
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false };
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
contexts[position]['labelContext'] = context.label;
contexts[position]['labelCategory'] = context['category'].label;
contexts[position]['labelCategory'] = category.label;
contexts[position]['labelConcept'] = categoryConcept.label;
position++;
@ -528,10 +532,12 @@ export class ParsingFunctions {
} else {
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
contexts[position]['labelContext'] = context.label;
contexts[position]['labelCategory'] = context['category'].label;
contexts[position]['labelCategory'] = category.label;
contexts[position]['labelConcept'] = null;
position++;
}
}
}
} else {
contexts[position] = {"labelContext": "", "labelCategory": "", "labelConcept": "", inline: false};
contexts[position]['labelContext'] = context.label;
@ -541,7 +547,6 @@ export class ParsingFunctions {
position++;
}
}
}
return contexts;
}