Search stakeholders fix a bug with parsing results

This commit is contained in:
Konstantinos Triantafyllou 2021-11-05 14:06:55 +02:00
parent fd3885d404
commit 5a64537d5c
1 changed files with 10 additions and 9 deletions

View File

@ -110,6 +110,13 @@ export class SearchStakeholdersComponent {
});
}
private parseResults(data: any) {
for (let i = 0; i < data.length; i++) {
this.totalResults[i] = data[i];
this.totalResults[i].isManager = this.isManager(data[i]);
this.totalResults[i].isMember = this.isMember(data[i]);
}
}
/**
* Initialize stakeholders from Communities APIs
@ -118,19 +125,13 @@ export class SearchStakeholdersComponent {
*/
private initFunders(params) {
if(this.totalResults) {
this.parseResults(this.totalResults);
this._getResults(params);
} else {
this.totalResults = [];
this.subscriptions.push(this._stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL).subscribe(
data => {
if (!data) {
return;
}
for (let i = 0; i < data.length; i++) {
this.totalResults[i] = data[i];
this.totalResults[i].isManager = this.isManager(data[i]);
this.totalResults[i].isMember = this.isMember(data[i]);
}
this.totalResults = [];
this.parseResults(data);
this._getResults(params);
},
err => {