From c5bd710621d052a5327ea2daea3654f95c23c863 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 24 Apr 2024 16:06:45 +0300 Subject: [PATCH] [develop | WIP | CHANGED]: [BETA] parsingFunctions.class.ts: Show all subjects as keywords - updated method "parseAllSubjects()" to add classified subjects (by vocabulary) to the end of the keyword subjects list. --- .../landing-utils/parsingFunctions.class.ts | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/landingPages/landing-utils/parsingFunctions.class.ts b/landingPages/landing-utils/parsingFunctions.class.ts index d5d614a3..799f71db 100644 --- a/landingPages/landing-utils/parsingFunctions.class.ts +++ b/landingPages/landing-utils/parsingFunctions.class.ts @@ -581,7 +581,7 @@ export class ParsingFunctions { return eoscSubjectsFound; } - + // publication & dataset landing : for subjects and otherSubjects and classifiedSubjects parseAllSubjects(_subjects: any, vocabulary: any): [string[], Map, Map, string[], string[],] { // let eoscSubjectsFound = []; @@ -590,12 +590,12 @@ export class ParsingFunctions { let classifiedSubjects: Map; let fos: string[]; let sdg: string[]; - + let setOfEoscSubjects: Set = new Set(); - + let subject; let length = Array.isArray(_subjects) ? _subjects.length : 1; - + for (let i = 0; i < length; i++) { subject = Array.isArray(_subjects) ? _subjects[i] : _subjects; if (subject.classid != "") { @@ -628,7 +628,7 @@ export class ParsingFunctions { if (classifiedSubjects == undefined) { classifiedSubjects = new Map(); } - + let content: string = subject.content + ""; // let checkAndAddEoscSubjectResp = this.checkAndAddEoscSubject(setOfEoscSubjects, eoscSubjectsFound, subject, content); // let found: boolean = checkAndAddEoscSubjectResp["found"]; @@ -639,7 +639,11 @@ export class ParsingFunctions { if (!classifiedSubjects.has(subject.classname)) { classifiedSubjects.set(subject.classname, new Array()); } - classifiedSubjects.get(subject.classname).push(content); + if(properties.environment == "production") { + classifiedSubjects.get(subject.classname).push(content); + } else { + classifiedSubjects.get(subject.classname).push(subject.classid + ": " + content); + } // } } } else { @@ -659,6 +663,14 @@ export class ParsingFunctions { } } } + + if(properties.environment != "production") { + for (let classified of classifiedSubjects.keys()) { + subjects = subjects.concat(classifiedSubjects.get(classified)); + } + classifiedSubjects = null; + } + return [subjects, otherSubjects, classifiedSubjects, fos, sdg]; }