Search stakeholders fix a bug with parsing results
This commit is contained in:
parent
fd3885d404
commit
5a64537d5c
|
@ -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
|
* Initialize stakeholders from Communities APIs
|
||||||
|
@ -118,19 +125,13 @@ export class SearchStakeholdersComponent {
|
||||||
*/
|
*/
|
||||||
private initFunders(params) {
|
private initFunders(params) {
|
||||||
if(this.totalResults) {
|
if(this.totalResults) {
|
||||||
|
this.parseResults(this.totalResults);
|
||||||
this._getResults(params);
|
this._getResults(params);
|
||||||
} else {
|
} else {
|
||||||
this.totalResults = [];
|
|
||||||
this.subscriptions.push(this._stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL).subscribe(
|
this.subscriptions.push(this._stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL).subscribe(
|
||||||
data => {
|
data => {
|
||||||
if (!data) {
|
this.totalResults = [];
|
||||||
return;
|
this.parseResults(data);
|
||||||
}
|
|
||||||
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._getResults(params);
|
this._getResults(params);
|
||||||
},
|
},
|
||||||
err => {
|
err => {
|
||||||
|
|
Loading…
Reference in New Issue