From 52fc9ce22af0b9434fd0e8532e6d8750f5a5ff25 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Tue, 25 Jul 2023 13:24:24 +0300 Subject: [PATCH] [Library | develop]: helper.class.ts: Added return false in method "isCurator()" as fallback | stakeholder.ts: Added return "" in methods "getFilter()", "getResultFilter()", "getProjectFilter()", "getOrganizationFilter()", "getCountryFilter()" as fallback | string-utils.class.ts: Added return null in method "getPIDFromIdentifiers()" as fallback. --- login/utils/helper.class.ts | 1 + monitor/entities/stakeholder.ts | 6 ++++++ utils/string-utils.class.ts | 16 ++++++++-------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/login/utils/helper.class.ts b/login/utils/helper.class.ts index 53708500..63e15b2f 100644 --- a/login/utils/helper.class.ts +++ b/login/utils/helper.class.ts @@ -131,6 +131,7 @@ export class Session { } else if (type == 'project') { return user && this.isProjectCurator(user); } + return false; } public static isPortalAdministrator(user: User): boolean { diff --git a/monitor/entities/stakeholder.ts b/monitor/entities/stakeholder.ts index 9284ad42..09ab7022 100644 --- a/monitor/entities/stakeholder.ts +++ b/monitor/entities/stakeholder.ts @@ -246,6 +246,8 @@ export class IndicatorFilterUtils { }else if (table == "organization"){ return this.getOrganizationFilter(filterType); } + + return ""; } static getResultFilter(table: string = null, filterType:FilterType) { //works for tables ["publication", "software", "dataset", "other", "result"] @@ -258,24 +260,28 @@ export class IndicatorFilterUtils { }else if (filterType == "co-funded") { return '{"groupFilters":[{"field":"' + table + '.No of funders","type":">","values":["1"]}],"op":"AND"}'; } + return ""; } static getProjectFilter( filterType:FilterType) { //works for table "project" if (filterType == "fundingL0") { return '{"groupFilters":[{"field":"project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}'; } + return ""; } static getOrganizationFilter( filterType:FilterType) { //works for table "organization" if (filterType == "fundingL0") { return '{"groupFilters":[{"field":"organization.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}'; } + return ""; } static getCountryFilter( filterType:FilterType) { //works for table "country" if (filterType == "fundingL0") { return '{"groupFilters":[{"field":"country.organization.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}'; } + return ""; } static filterIndexOf(filterToAdd, currentFilters):any{ diff --git a/utils/string-utils.class.ts b/utils/string-utils.class.ts index c21fa9f1..8c6577c4 100644 --- a/utils/string-utils.class.ts +++ b/utils/string-utils.class.ts @@ -209,16 +209,16 @@ export class Identifier { public static getPIDFromIdentifiers(identifiers: Map): Identifier { let classes:string [] = ["doi", "handle", "pmc", "pmid", "re3data"]; - if(identifiers) { - for (let cl of classes){ - if(identifiers.get(cl)){ - for (let pid of identifiers.get(cl)) { - let identifier = Identifier.getIdentifierFromString(pid); - if (identifier){ - return identifier; - } + if(identifiers) { + for (let cl of classes) { + if (identifiers.get(cl)) { + for (let pid of identifiers.get(cl)) { + let identifier = Identifier.getIdentifierFromString(pid); + if (identifier) { + return identifier; } } + } } return null; }