[develop | DONE | CHANGED] community home page: use method for grouped count queries

This commit is contained in:
argirok 2024-03-13 12:05:31 +02:00
parent 73b9a03d60
commit 1f29b3200f
1 changed files with 10 additions and 4 deletions

View File

@ -232,10 +232,7 @@ export class CommunityComponent {
}
}));
this.countResearchResults("publication");
this.countResearchResults("dataset");
this.countResearchResults("software");
this.countResearchResults("other");
this.getCountResearchResults();
if(this.communityId == "enermaps"){
this.countResearchResults("dataset", "enermaps::selection" );
}
@ -389,6 +386,15 @@ export class CommunityComponent {
}
this.reloadFeaturedDatasets = false;
}
private getCountResearchResults(){
this.fetchPublications.searchUtils.status = this.errorCodes.LOADING;
this._searchResearchResultsService.countResults("communityid", this.communityId).subscribe(res =>{
this.fetchPublications.searchUtils.totalResults = res['publications'];
this.fetchDatasets.searchUtils.totalResults = res['datasets'];
this.fetchSoftware.searchUtils.totalResults = res['software'];
this.fetchOrps.searchUtils.totalResults = res['other'];
})
}
private countResearchResults(resultType: string, contextId = null) {
let fetch: FetchResearchResults;