[deprecated-angular-upgrade | DONE | FIXED]: number-utils.class.ts: avoid rounding numbers < 1000 (3-digit) | refineFieldResults.service.ts: Added method "getAllRefineFieldResultsByFieldName()" to get all values of a specific refine field (not just first 100) | numbers.component.ts: Updated method called in refine query to get funders of projects from "getRefineFieldsResultsByEntityName()" to "getAllRefineFieldResultsByFieldName()" to be able to get more than 100 funders each time.

This commit is contained in:
Konstantina Galouni 2023-11-24 13:53:46 +02:00
parent 93cdc71cf0
commit 8672fb6359
3 changed files with 19 additions and 6 deletions

View File

@ -26,6 +26,19 @@ export class RefineFieldResultsService {
.pipe(map(res => [res['meta'].total, RefineResultsUtils.parse(res['refineResults'],fields, entityName)]));
}
getAllRefineFieldResultsByFieldName(fieldName:string, entityName:string, properties:EnvProperties, refineQuery:string=null):any{
// let keys:string[]=["funder", "relfunder", "fundinglevel"];
let url = properties.searchAPIURLLAst +this.getSearchAPIURLForEntity(entityName)+"?fields="+fieldName +('&sf='+fieldName)+ "&format=json";
if(refineQuery!= null && refineQuery != '' ) {
url += refineQuery;
}
return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url)
//.map(res => <any> res.json())
.pipe(map(res => [res['meta'].total, RefineResultsUtils.parse(res['refineResults'],[fieldName], entityName)]));
}
getRefineFieldResultsByFieldName(fieldName:string, entityName:string, properties:EnvProperties):any{
let key:string="fundinglevel";
let link = properties.searchAPIURLLAst +this.getSearchAPIURLForEntity(entityName)+"?fields="+fieldName +(fieldName.toString().indexOf(key)!=-1?('&sf='+fieldName):'')+ "&format=json";

View File

@ -259,7 +259,7 @@ export class NumbersComponent implements OnInit, OnDestroy {
(getSoftware) ? this.searchResearchResultsService.numOfSearchResults('software', '', this.properties, refineParams) : this.empty,
(getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty,
(getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty,
(getProjects) ? this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['funder'], 'project', this.properties, refineParams) : this.empty,
(getProjects) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty,
(getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty
).subscribe((data: any[]) => {
if (data[0] && data[0] > 0) {

View File

@ -18,11 +18,11 @@ export class NumberUtils{
num=num/1000;
num= Math.round(num);
roundNum = { number: num, size: "K", count: initialNum};
}else if (num >= 100) {
num=num/100;
num= Math.round(num);
num=num*100;
roundNum = { number: num, size: "" , count: initialNum};
// }else if (num >= 100) {
// num=num/100;
// num= Math.round(num);
// num=num*100;
// roundNum = { number: num, size: "" , count: initialNum};
}else{
roundNum = { number: num, size: "" , count: initialNum};
}