Merge branch 'angular-16-irish-monitor' of code-repo.d4science.org:MaDgIK/openaire-library into angular-16-irish-monitor
This commit is contained in:
commit
f07d1778c5
|
@ -53,6 +53,30 @@ export class StakeholderService {
|
|||
}
|
||||
return from(this.getStakeholderAsync());
|
||||
}
|
||||
getResearcherStakeholder( orcid, name, results, shouldUpdate: boolean = false): Observable<Stakeholder> {
|
||||
if (!this.stakeholderSubject.value || this.stakeholderSubject.value.alias !== orcid || shouldUpdate) {
|
||||
this.promise = new Promise<void>((resolve, reject) => {
|
||||
this.sub = this.http.get<Stakeholder>(properties.monitorServiceAPIURL + '/stakeholder/' + encodeURIComponent("researcher"), CustomOptions.registryOptions()).pipe(map(stakeholder => {
|
||||
return this.formalize(this.checkIsUpload(stakeholder));
|
||||
})).subscribe(stakeholder => {
|
||||
stakeholder.index_id = orcid;
|
||||
stakeholder.index_name = name;
|
||||
stakeholder.name = name;
|
||||
stakeholder.alias = orcid;
|
||||
if(results <10 && stakeholder.topics[0]?.categories[0]?.subCategories[0]){
|
||||
stakeholder.topics[0].categories[0].subCategories[0].charts=[]; // keep only numbers - charts wont show much anyway
|
||||
}
|
||||
this.stakeholderSubject.next(stakeholder);
|
||||
resolve();
|
||||
}, error => {
|
||||
let stakeholder = new Stakeholder(null,"researcher", orcid,name,name,orcid,"PUBLIC", null, null,"");
|
||||
this.stakeholderSubject.next(stakeholder);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
return from(this.getStakeholderAsync());
|
||||
}
|
||||
|
||||
async getStakeholderAsync() {
|
||||
if (this.promise) {
|
||||
|
|
Loading…
Reference in New Issue