Merge remote-tracking branch 'origin/develop'

This commit is contained in:
Konstantina Galouni 2024-09-23 14:11:11 +03:00
commit 5f4e40a834
9 changed files with 342 additions and 28 deletions

View File

@ -21,6 +21,7 @@ import {AlertModal} from './openaireLibrary/utils/modal/alert';
import {NotificationHandler} from "./openaireLibrary/utils/notification-handler";
import {QuickContactService} from './openaireLibrary/sharedComponents/quick-contact/quick-contact.service';
import {LayoutService} from './openaireLibrary/dashboard/sharedComponents/sidebar/layout.service';
import {ISVocabulariesService} from "./openaireLibrary/utils/staticAutoComplete/ISVocabularies.service";
@Component({
selector: 'app-root',
@ -38,6 +39,12 @@ import {LayoutService} from './openaireLibrary/dashboard/sharedComponents/sideba
description="OpenAIRE Explore: Over 100M of research deduplicated, 170K research software, 11M research data. One of the largest open scholarly records collection worldwide."></schema2jsonld>
<div [class.uk-hidden]="loading" [ngClass]="rootClass">
<div id="modal-container"></div>
<!-- <span class="js-upload" uk-form-custom>-->
<!-- <input id="exampleInputFile" class="uk-width-medium" type="file" (change)="fileChangeEvent($event)"/>-->
<!-- <span class="uk-link " style="text-decoration: underline;">Parse NEW FOS</span>-->
<!-- </span>-->
<!-- <a (click)="checkDifferences()" class="uk-margin-left uk-link ">Check if different FOS codes/labels</a>-->
<main>
<router-outlet></router-outlet>
</main>
@ -84,9 +91,224 @@ export class AppComponent implements AfterViewInit {
private router: Router, private userManagementService: UserManagementService, private smoothScroll: SmoothScroll,
private configurationService: ConfigurationService, private _meta: Meta, private seoService: SEOService,
private emailService: EmailService, private fb: FormBuilder, private quickContactService: QuickContactService,
private layoutService: LayoutService, private cdr: ChangeDetectorRef) {
private layoutService: LayoutService, private cdr: ChangeDetectorRef,
private ISVocabulariesService: ISVocabulariesService) {
}
// fileChangeEvent(fileInput: any) {
// let file = <Array<File>>fileInput.target.files;
// this.parseNewFos(file);
// }
//
// makeFileRequest(url: string, params: Array<string>, files: Array<File>) {
// return new Promise<void>((resolve, reject) => {
// const formData: any = new FormData();
// const xhr = new XMLHttpRequest();
// for (let i = 0; i < files.length; i++) {
// formData.append("uploads[]", files[i], files[i].name);
// }
// xhr.onreadystatechange = function () {
// if (xhr.readyState == 4) {
// if (xhr.status == 200) {
// resolve(xhr.response);
// } else {
// reject(xhr.response);
// }
// }
// }
//
// xhr.open("POST", url, true);
// xhr.send(formData);
// });
// }
//
// parseNewFos(file: Array<File>) {
// let fos = null;
// this.makeFileRequest(this.properties.utilsService + '/upload', [], file).then((result) => {
// this.ISVocabulariesService.getFos(properties).subscribe(fosRes => {
// fos = fosRes['fos'];
// for(let fieldL1 of fos) {
// if(fieldL1.children != null) {
// for (let fieldL2 of fieldL1.children) {
// if(fieldL2.children != null) {
// for (let fieldL3 of fieldL2.children) {
// if(fieldL3.children != null)
// fieldL3.children = [];
// }
// }
// }
// }
// }
// // console.log(fos);
// let setOfCodes: Set<string> = new Set<string>();
// let duplicates = new Map<string, string[]>;
// const rows = (result as any).split('\n'); // I have used space, you can use any thing.
// let added = false;
// for (let i = 0; i < (rows.length); i++) {
// if (rows[i] && rows[i] != null && rows[i] != "") {
// added = false;
// let code = rows[i].split(' ')[0];
// if(setOfCodes.has(code)) {
// console.log("SAME CODE!!!!!!!!");
// } else {
// setOfCodes.add(code);
// }
// let label = rows[i].substring(code.length+1, rows[i].length);
// // console.log(rows[i]);
// let firstLevel = rows[i].substring(0, 2);
// let secondLevel = rows[i].substring(0, 4);
// let thirdLevel = rows[i].substring(0, 6);
// for(let fieldL1 of fos) {
// if(fieldL1.code == firstLevel) {
// for(let fieldL2 of fieldL1.children) {
// if(fieldL2.code == secondLevel) {
// for(let fieldL3 of fieldL2.children) {
// if(fieldL3.code == thirdLevel) {
// if(fieldL3.children == null) {
// fieldL3.children = [];
// }
// fieldL3.children.push({
// "code": code,
// "id": rows[i],
// "label": label,
// "level": 4
// })
// added = true;
// break;
// }
// }
// if(!added && (!fieldL2.children || fieldL2.children.filter(field => field.code == thirdLevel).length == 0)) {
// console.log("Level 3 not found for "+rows[i]);
// }
// break;
// }
// }
// if(!added && (!fieldL1.children || fieldL1.children.filter(field => field.code == secondLevel).length == 0)) {
// console.log("Level 2 not found for "+rows[i]);
// }
// break;
// }
// }
//
// if(!added && fos.filter(field => field.code == firstLevel).length == 0) {
// console.log("Level 1 not found for |"+rows[i]+"|");
// }
// }
// }
//
// for(let l1 of fos) {
// if(duplicates.has(l1.label)) {
// duplicates.get(l1.label).push(l1.id);
// } else {
// duplicates.set(l1.label, [l1.id]);
// }
// if(l1.children) {
// for (let l2 of l1.children) {
// if(duplicates.has(l2.label)) {
// duplicates.get(l2.label).push(l2.id);
// } else {
// duplicates.set(l2.label, [l2.id]);
// }
//
// if(l2.children) {
// for(let l3 of l2.children) {
// if(duplicates.has(l3.label)) {
// duplicates.get(l3.label).push(l3.id);
// } else {
// duplicates.set(l3.label, [l3.id]);
// }
//
// if(l3.children) {
// for(let l4 of l3.children) {
// if(duplicates.has(l4.label)) {
// duplicates.get(l4.label).push(l4.id);
// } else {
// duplicates.set(l4.label, [l4.id]);
// }
// }
// }
// }
// }
// }
// }
// }
//
// for(let label of duplicates.keys()) {
// if(duplicates.get(label).length > 1) {
// console.log(label, duplicates.get(label));
// }
// }
// var url = window.URL.createObjectURL(new Blob([JSON.stringify(fos)]));
// var a = window.document.createElement('a');
// window.document.body.appendChild(a);
// a.setAttribute('style', 'display: none');
// a.href = url;
// a.download = "fosNewL4.json";
// a.click();
// window.URL.revokeObjectURL(url);
// a.remove(); // remove the element
//
// // var theJSON = JSON.stringify(fos);
// // var uri = this.sanitizer.bypassSecurityTrustUrl("data:text/json;charset=UTF-8," + encodeURIComponent(theJSON));
// // this.downloadJsonHref = uri;
// // console.log(fos);
// });
// });
// }
//
// checkDifferences() {
// this.ISVocabulariesService.getIndexedFosL4(properties).subscribe(fosRes => {
// console.log(fosRes);
// this.ISVocabulariesService.getFos(properties).subscribe(currentFos => {
// console.log(currentFos);
// let currentSet: Map<string, string> = new Map<string, string>();
// for(let currentL1 of currentFos['fos']) {
// if(currentL1.children?.length > 0) {
// for(let currentL2 of currentL1.children) {
// if(currentL2.children?.length > 0) {
// for(let currentL3 of currentL2.children) {
// if(currentL3.children?.length > 0) {
// for(let currentL4 of currentL3.children) {
// if(currentSet.has(currentL4.code)) {
// console.log("ALREADY HERE ",currentL4.code);
// }
// currentSet.set(currentL4.code, currentL4.label);
// }
// }
// }
// }
// }
// }
// }
//
// console.log(currentSet);
// for (let fos of fosRes) {
// if(!currentSet.has(fos.l4code)) {
// console.log(fos.l4code + " does not exist in current voc");
// } else {
// if(currentSet.get(fos.l4code) != fos.l4label) {
// console.log(fos.l4code + " different label");
// }
// }
// }
//
// for(let code of currentSet.keys()) {
// let found = false;
// for(let fos of fosRes) {
// if(fos.l4code == code) {
// found = true;
// break;
// }
// }
// if(!found) {
// console.log("current code "+code+" not indexed");
// }
// }
// });
// });
// }
ngOnInit() {
if (typeof document !== 'undefined') {
this.isClient = true;

View File

@ -204,9 +204,9 @@
</div>
</div>
<div class="monitor-dashboard uk-padding-small uk-padding-remove-left uk-margin-medium-left">
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.monitorDashboard">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
@ -220,6 +220,23 @@
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
<a *ngIf="funder.irishDashboard && funder.irishDashboardStatus && funder.irishDashboardStatus != 'PRIVATE' && funder.irishDashboardStatus != 'RESTRICTED' && properties.environment != 'beta'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'oamonitor.ireland.openaire.eu/rfo/'+funder.irishDashboard">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/small_irish.svg" alt="Irish logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="irish-dashboard-link uk-text-uppercase">RFO Dashboard</span>
</span>
</a>
<span *ngIf="funder.irishDashboard && funder.irishDashboardStatus && (funder.irishDashboardStatus == 'RESTRICTED' || properties.environment =='beta')"
class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/small_irish.svg" alt="Irish logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="irish-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">RFO Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
</div>
</div>
</ng-container>
@ -238,7 +255,7 @@
<div class="uk-flex uk-flex-column uk-flex-center">
<div class="uk-flex uk-flex-middle">
<!-- <span class="uk-text-xsmall uk-margin-small-right">flag</span> -->
<span class="fi uk-text-xsmall uk-margin-small-right" [ngClass]="'fi-'+funder.country | lowercase"></span>
<span *ngIf="funder.country" class="fi uk-text-xsmall uk-margin-small-right" [ngClass]="'fi-'+funder.country | lowercase"></span>
<div class="uk-h6 uk-margin-remove uk-text-truncate">
<ng-container *ngIf="funder.name">
<span>{{funder.name}}</span>
@ -250,10 +267,10 @@
</ng-container>
</div>
</div>
<div *ngIf="funder.monitorDashboard" class="uk-margin-top">
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
<div *ngIf="funder.monitorDashboard || funder.irishDashboard" class="uk-margin-top">
<a *ngIf="funder.monitorDashboard && funder.monitorDashboardStatus && funder.monitorDashboardStatus != 'PRIVATE' && funder.monitorDashboardStatus != 'RESTRICTED'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.alias">
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.monitorDashboard">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/Symbol.png" alt="OpenAIRE logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
@ -267,6 +284,23 @@
<span class="monitor-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">Monitor Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
<a *ngIf="funder.irishDashboard && funder.irishDashboardStatus && funder.irishDashboardStatus != 'PRIVATE' && funder.irishDashboardStatus != 'RESTRICTED' && properties.environment != 'beta'"
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"
target="_blank" [href]="'https://'+(properties.environment =='beta' || properties.environment =='development'?'beta.':'')+'monitor.openaire.eu/dashboard/'+funder.irishDashboard">
<span class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/small_irish.svg" alt="Irish logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="irish-dashboard-link uk-text-uppercase">RFO Dashboard</span>
</span>
</a>
<span *ngIf="funder.irishDashboard && funder.irishDashboardStatus && (funder.irishDashboardStatus == 'RESTRICTED' || properties.environment == 'beta')"
class="uk-flex uk-flex-middle">
<img src="assets/common-assets/common/small_irish.svg" alt="Irish logo"
class="uk-margin-xsmall-right" style="width: 17px; height: 17px;" loading="lazy">
<span class="irish-dashboard-link uk-text-uppercase uk-text-bold uk-text-small">RFO Dashboard</span>
<icon class="uk-margin-xsmall-left" name="closed_access" [flex]="true" [ratio]="1"></icon>
</span>
</div>
</div>
<div class="uk-flex uk-flex-middle uk-child-width-1-3">

View File

@ -1,6 +1,12 @@
@import (reference) "~src/assets/openaire-theme/less/color.less";
@import "flag-icons/css/flag-icons.min.css";
@irish-color: #FF7901;
.irish-dashboard-link {
color: @irish-color;
}
.custom-coins-dot:after {
content: "";
background-image: url("~src/assets/explore-assets/funders/coins.svg");

View File

@ -55,13 +55,16 @@ export class FundersComponent implements OnInit {
"id": string,
"name": string,
"shortName": string,
"alias": string,
"researchProducts": number,
// "alias": string,
// "irishAlias": string,
"researchProducts": number,
"openAccessResearchProducts": number,
"openAccessPercentage": number,
"projects": number,
"monitorDashboard": string,
"monitorDashboardStatus": string,
"monitorDashboardStatus": string,
"irishDashboard": string,
"irishDashboardStatus": string,
"logoUrl": string,
"websiteUrl": string,
"country": string,
@ -111,7 +114,8 @@ export class FundersComponent implements OnInit {
}));
this.showOptions = [
{value: 'all', label: 'All funders'},
{value: 'dashboard', label: 'Funders with dashboard'}
{value: 'monitor', label: 'Funders with Monitor dashboard'},
{value: 'rfo', label: 'Funders with RFO dashboard'}
];
this.sortOptions = [
{value: 'alphAsc', label: 'Alphabetically asc. (A-Z)'},
@ -162,13 +166,16 @@ export class FundersComponent implements OnInit {
"id": id,
"name": this.removePartAfterCharacters(queriedFunder.name, "||"),
"shortName": queriedFunder.shortName,
"alias": '',
// "alias": '',
// "irishAlias": '',
"researchProducts": +queriedFunder.results,
"openAccessResearchProducts": +queriedFunder.openResults,
"openAccessPercentage": 0,
"projects": +queriedFunder.projects,
"monitorDashboard": '',
"monitorDashboardStatus": '',
"irishDashboard": '',
"irishDashboardStatus": '',
"logoUrl": '',
"websiteUrl": '',
"country": queriedFunder.country,
@ -181,12 +188,15 @@ export class FundersComponent implements OnInit {
if(queriedFunder.stakeholder) {
let stakeholder = queriedFunder.stakeholder;
funder.alias = stakeholder.alias;
if(!funder.shortName) {
funder.shortName = stakeholder.alias;
}
// funder.alias = stakeholder.alias;
// funder.irishAlias = stakeholder.irishAlias;
// if(!funder.shortName) {
// funder.shortName = stakeholder.alias;
// }
funder.monitorDashboard = stakeholder.alias;
funder.monitorDashboardStatus = stakeholder.visibility;
funder.irishDashboard = stakeholder.irishAlias;
funder.irishDashboardStatus = stakeholder.irishVisibility;
if(stakeholder.logoUrl) {
funder.logoUrl = (stakeholder.isUpload ? properties.utilsService + "/download/" : "") + (stakeholder.logoUrl);
}
@ -385,10 +395,16 @@ export class FundersComponent implements OnInit {
this.keyword = '';
}
if(this.funders.length) {
displayedFunders = displayedFunders.filter(item => (item['name'] && item['name'].toLowerCase().includes(this.keyword.toLowerCase())) || (item['alias'] && item['alias'].toLowerCase().includes(this.keyword.toLowerCase())));
displayedFunders = displayedFunders.filter(item => (item['name'] && item['name'].toLowerCase().includes(this.keyword.toLowerCase()))
|| (item['monitorDashboard'] && item['monitorDashboard'].toLowerCase().includes(this.keyword.toLowerCase())
|| (item['irishDashboard'] && item['irishDashboard'].toLowerCase().includes(this.keyword.toLowerCase()))));
}
if(this.show == 'dashboard') {
displayedFunders = displayedFunders.filter(funder => funder.monitorDashboard && funder.monitorDashboard?.length > 0 && funder.monitorDashboardStatus != 'PRIVATE');
if(this.show == 'monitor') {
displayedFunders = displayedFunders.filter(funder => funder.monitorDashboard && funder.monitorDashboard?.length > 0 && ((funder.monitorDashboardStatus && funder.monitorDashboardStatus != 'PRIVATE')));
}
if(this.show == 'rfo') {
displayedFunders = displayedFunders.filter(funder => funder.monitorDashboard && funder.monitorDashboard?.length > 0 && ((funder.irishDashboardStatus && funder.irishDashboardStatus != 'PRIVATE')));
}
this.displayedFunders = displayedFunders;

View File

@ -43,6 +43,10 @@
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
<title>Search OpenAIRE</title>
<!-- <link-->
<!-- rel="stylesheet"-->
<!-- href="https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/css/flag-icons.min.css"-->
<!-- />-->
</head>
<body>
<div class="uk-offcanvas-content uk-height-viewport">

View File

@ -1,6 +1,7 @@
userInfoUrl = https://beta.services.openaire.eu/login-service/userInfo
searchServiceAPIUrl = https://beta.services.openaire.eu/search/v2/api/
monitorAPIUrl = https://beta.services.openaire.eu/uoa-monitor-service/
irishMonitorAPIUrl = https://beta.services.openaire.eu/irish-monitor-service/
fundersServiceAPIUrl = https://beta.services.openaire.eu/openaire/funders/
ssl = true
localPath = false

View File

@ -1,6 +1,7 @@
userInfoUrl = https://services.openaire.eu/login-service/userInfo
searchServiceAPIUrl = https://services.openaire.eu/search/v2/api/
monitorAPIUrl = https://services.openaire.eu/uoa-monitor-service/
irishMonitorAPIUrl = https://services.openaire.eu/irish-monitor-service/
fundersServiceAPIUrl = https://services.openaire.eu/openaire/funders/
ssl = true
localPath = false

View File

@ -1,7 +1,8 @@
userInfoUrl = http://mpagasas.di.uoa.gr:19080/login-service/userInfo
searchServiceAPIUrl = https://beta.services.openaire.eu/search/v2/api/
monitorAPIUrl = http://duffy.di.uoa.gr:19380/uoa-monitor-service/
fundersServiceAPIUrl = https://beta.services.openaire.eu/openaire/funders/
irishMonitorAPIUrl = http://mpagasas.di.uoa.gr:19780/irish-monitor-service/
fundersServiceAPIUrl = https://dev-openaire.d4science.org/openaire/funders/
ssl = false
localPath = true
# photo size in KB

View File

@ -15,6 +15,7 @@ if (properties.get('ssl')) {
}
var searchServiceAPIUrl = properties.get('searchServiceAPIUrl');
var monitorServiceAPIUrl = properties.get('monitorAPIUrl');
var irishMonitorServiceAPIUrl = properties.get('irishMonitorAPIUrl');
var fundersServiceAPIUrl = properties.get('fundersServiceAPIUrl');
var auth = properties.get('userInfoUrl');
/** @deprecated*/
@ -130,7 +131,8 @@ app.get('/explore/home', async function (req, res) {
funders: parseNoOfFunders(dataResponses[1].data, dataResponses[4].data),
datasetsInterlinked:dataResponses[5].data.meta.total,
softwareInterlinked:dataResponses[6].data.meta.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
// Send the aggregated data as the response
@ -161,7 +163,8 @@ app.get('/explore/search', async function (req, res) {
datasources: dataResponses[1].data.total,
organizations: dataResponses[2].data.meta.total,
projects:dataResponses[3].data.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
@ -203,7 +206,8 @@ app.get('/portals/countResults', async function (req, res) {
datasets: dataResponses[1].data.total,
software: dataResponses[2].data.total,
other:dataResponses[3].data.total,
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
@ -224,6 +228,7 @@ app.get('/explore/funders', async function (req, res) {
searchServiceAPIUrl + 'resources2/?format=json&type=results&fq=relfunder=*&refine=true&fields=relfunder&sf=relfunder&page=0&size=0&fq=resultbestaccessright%20exact%20%22Open%20Access%22',
searchServiceAPIUrl + 'resources2/?format=json&type=projects&fq=funder=*&fq=projectcode<>"unidentified"&refine=true&fields=funder&sf=funder&page=0&size=0',
monitorServiceAPIUrl + 'stakeholder?type=funder',
irishMonitorServiceAPIUrl + 'stakeholder?type=funder',
fundersServiceAPIUrl
]
const dataPromises = requests.map((url) => axios.get( url));
@ -267,6 +272,7 @@ app.get('/explore/funders', async function (req, res) {
let ministakeholder = {
id:id, name:stakeholder.name,
alias: stakeholder.alias, visibility: stakeholder.visibility,
irishAlias: '', irishVisibility: '',
logoUrl:stakeholder.logoUrl, isUpload: stakeholder.isUpload, websiteUrl: null}
fundersMap.get(id).stakeholder = ministakeholder;
@ -276,7 +282,25 @@ app.get('/explore/funders', async function (req, res) {
}
});
let funders = dataResponses[4].data;
let irishStakeholders = dataResponses[4].data;
irishStakeholders.forEach(stakeholder => {
let id = stakeholder.index_id + "||" + stakeholder.index_name + "||" + stakeholder.index_shortName;
if (fundersMap.has(id) && (!fundersMap.get(id).stakeholder || (fundersMap.get(id).name === stakeholder.name) || (fundersMap.get(id).shortName === stakeholder.index_shortName))) {
let ministakeholder = {
id:id, name:stakeholder.name,
alias: fundersMap.get(id).stakeholder ? fundersMap.get(id).stakeholder.alias : '',
visibility: fundersMap.get(id).stakeholder ? fundersMap.get(id).stakeholder.visibility : '',
irishAlias: stakeholder.alias, irishVisibility: stakeholder.visibility,
logoUrl:stakeholder.logoUrl, isUpload: stakeholder.isUpload, websiteUrl: null}
fundersMap.get(id).stakeholder = ministakeholder;
if(!fundersMap.get(id).shortName) {
fundersMap.get(id).shortName = stakeholder.index_shortName;
}
}
});
let funders = dataResponses[5].data;
funders.forEach(funder => {
// let id = funder.id + "||" + (funder.legalName ? (funder.legalName + "||" + (funder.legalShortName ? funder.legalShortName : "")) : "");
// if (fundersMap.has(id)) {
@ -306,9 +330,13 @@ app.get('/explore/funders', async function (req, res) {
// }
let ministakeholder = {
id:storedFunder.id, name:storedStakeholder?.name, alias: storedStakeholder?.alias ? storedStakeholder.alias : funder.legalShortName,
id:storedFunder.id, name:storedStakeholder?.name,
alias: storedStakeholder?.alias ? storedStakeholder.alias : funder.legalShortName,
visibility: storedStakeholder?.visibility,
irishAlias: storedStakeholder?.irishAlias ? storedStakeholder.irishAlias : funder.legalShortName,
irishVisibility: storedStakeholder?.irishVisibility,
websiteUrl: funder.websiteUrl, logoUrl: storedStakeholder?.logoUrl ? storedStakeholder.logoUrl : funder.logoUrl,
visibility: storedStakeholder?.visibility, isUpload: storedStakeholder?.isUpload
isUpload: storedStakeholder?.isUpload
};
storedFunder.stakeholder = ministakeholder;
// } else {
@ -332,7 +360,8 @@ app.get('/explore/funders', async function (req, res) {
results: dataResponses[0].data.meta.total,
projects: dataResponses[2].data.meta.total,
funders: Array.from(fundersMap.values()),
success:allRequestsSuccessful
success:allRequestsSuccessful,
calculated_at: (new Date()).toUTCString()
};
res.status(allRequestsSuccessful?200:207).json(aggregatedData);