@ -93,124 +93,112 @@ export class NumbersComponent implements OnInit, OnDestroy {
}
let refineParams = ( this . refineValue ) ? ( '&fq=' + this . refineValue ) : null ;
// let mergedFundersSet = new Set<string>();
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(((getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty).subscribe(x => {}));
// this.subs.push(zip(
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// // (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// (getPublications) ? this.searchResearchResultsService.numOfSearchResults('publication', '', this.properties, refineParams) : this.empty,
// (getDatasets) ? this.searchResearchResultsService.numOfSearchResults('dataset', '', this.properties, refineParams) : this.empty,
// (getDatasetsLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("dataset", this.properties) : this.empty,
// (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.getAllRefineFieldResultsByFieldName('funder', 'project', this.properties, refineParams) : this.empty,
// (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty,
// (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty,
// (getPublications && getDatasets && getSoftware && getOther) ? this.refineFieldResultsService.getAllRefineFieldResultsByFieldName('relfunder', 'result', this.properties, refineParams) : this.empty,
// ).subscribe((data: any[]) => {
// if (data[0] && data[0] > 0) {
// this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]);
// }
// if (data[1] && data[1] > 0) {
// this.numbers.datasetsSize = NumberUtils.roundNumber(data[1]);
// }
// if (data[2] && data[2] > 0) {
// this.numbers.datasetsLinkedSize = NumberUtils.roundNumber(data[2]);
// }
// if (data[3] && data[3] > 0) {
// this.numbers.softwareSize = NumberUtils.roundNumber(data[3]);
// }
// if (data[4] && data[4] > 0) {
// this.numbers.softwareLinkedSize = NumberUtils.roundNumber(data[4]);
// }
// if (data[5] && data[5] > 0) {
// this.numbers.otherSize = NumberUtils.roundNumber(data[5]);
// }
// if (data[6][0] && data[6][0] > 0) {
// this.numbers.projectsSize = NumberUtils.roundNumber(data[6][0]);
// }
// if (data[6][1] && data[6][1].length > 0 && data[6][1][0].filterId == 'funder' && data[6][1][0].values) {
// this.numbers.fundersSize = NumberUtils.roundNumber(data[6][1][0].values.length);
//
// let queriedFunders = data[6][1][0].values;
// queriedFunders.forEach(queriedFunder => {
// if(+queriedFunder.number > 1) {
// if (!mergedFundersSet.has(queriedFunder.id)) {
// mergedFundersSet.add(queriedFunder.id);
// }
// }
// });
// }
// if (data[7] && data[7] > 0) {
// this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]);
// }
// if (data[8] && data[8] > 0) {
// this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]);
// }
// if (data[9][1] && data[9][1].length > 0 && data[9][1][0].filterId == 'relfunder' && data[9][1][0].values) {
// let queriedFunders = data[9][1][0].values;
// queriedFunders.forEach(queriedFunder => {
// if (!mergedFundersSet.has(queriedFunder.id)) {
// mergedFundersSet.add(queriedFunder.id);
// }
// });
// }
//
// this.numbers.mergedFundersSize = NumberUtils.roundNumber(mergedFundersSet.size);
this . subs . push ( this . groupedRequestsService . home ( ) . subscribe ( ( data : any [ ] ) = > {
if ( data ) {
if ( data . hasOwnProperty ( "publications" ) && data [ 'publications' ] > 0 ) {
this . numbers . publicationsSize = NumberUtils . roundNumber ( data [ 'publications' ] ) ;
}
if ( data . hasOwnProperty ( "datasets" ) && data [ 'datasets' ] > 0 ) {
this . numbers . datasetsSize = NumberUtils . roundNumber ( data [ 'datasets' ] ) ;
}
if ( data . hasOwnProperty ( "datasetsInterlinked" ) && data [ 'datasetsInterlinked' ] > 0 ) {
this . numbers . datasetsLinkedSize = NumberUtils . roundNumber ( data [ 'datasetsInterlinked' ] ) ;
if ( refineParams ) {
let mergedFundersSet = new Set < string > ( ) ;
this . subs . push ( zip (
( getPublications ) ? this . searchResearchResultsService . numOfSearchResults ( 'publication' , '' , this . properties , refineParams ) : this . empty ,
( getDatasets ) ? this . searchResearchResultsService . numOfSearchResults ( 'dataset' , '' , this . properties , refineParams ) : this . empty ,
( getDatasetsLinked ) ? this . searchResearchResultsService . numOfSearchResultsLinkedToPub ( "dataset" , this . properties ) : this . empty ,
( 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 . getAllRefineFieldResultsByFieldName ( 'funder' , 'project' , this . properties , refineParams ) : this . empty ,
( getDataProviders ) ? this . searchDataprovidersService . numOfSearchDataproviders ( '' , this . properties , refineParams ) : this . empty ,
( getOrganizations ) ? this . _searchOrganizationsService . numOfSearchOrganizations2 ( '' , this . properties , refineParams ) : this . empty ,
( getPublications && getDatasets && getSoftware && getOther ) ? this . refineFieldResultsService . getAllRefineFieldResultsByFieldName ( 'relfunder' , 'result' , this . properties , refineParams ) : this . empty ,
) . subscribe ( ( data : any [ ] ) = > {
if ( data [ 0 ] && data [ 0 ] > 0 ) {
this . numbers . publicationsSize = NumberUtils . roundNumber ( data [ 0 ] ) ;
}
if ( data [ 1 ] && data [ 1 ] > 0 ) {
this . numbers . datasetsSize = NumberUtils . roundNumber ( data [ 1 ] ) ;
}
if ( data [ 2 ] && data [ 2 ] > 0 ) {
this . numbers . datasetsLinkedSize = NumberUtils . roundNumber ( data [ 2 ] ) ;
}
if ( data [ 3 ] && data [ 3 ] > 0 ) {
this . numbers . softwareSize = NumberUtils . roundNumber ( data [ 3 ] ) ;
}
if ( data [ 4 ] && data [ 4 ] > 0 ) {
this . numbers . softwareLinkedSize = NumberUtils . roundNumber ( data [ 4 ] ) ;
}
if ( data [ 5 ] && data [ 5 ] > 0 ) {
this . numbers . otherSize = NumberUtils . roundNumber ( data [ 5 ] ) ;
}
if ( data [ 6 ] [ 0 ] && data [ 6 ] [ 0 ] > 0 ) {
this . numbers . projectsSize = NumberUtils . roundNumber ( data [ 6 ] [ 0 ] ) ;
}
if ( data [ 6 ] [ 1 ] && data [ 6 ] [ 1 ] . length > 0 && data [ 6 ] [ 1 ] [ 0 ] . filterId == 'funder' && data [ 6 ] [ 1 ] [ 0 ] . values ) {
this . numbers . fundersSize = NumberUtils . roundNumber ( data [ 6 ] [ 1 ] [ 0 ] . values . length ) ;
let queriedFunders = data [ 6 ] [ 1 ] [ 0 ] . values ;
queriedFunders . forEach ( queriedFunder = > {
if ( + queriedFunder . number > 1 ) {
if ( ! mergedFundersSet . has ( queriedFunder . id ) ) {
mergedFundersSet . add ( queriedFunder . id ) ;
}
}
} ) ;
}
if ( data [ 7 ] && data [ 7 ] > 0 ) {
this . numbers . datasourcesSize = NumberUtils . roundNumber ( data [ 7 ] ) ;
}
if ( data [ 8 ] && data [ 8 ] > 0 ) {
this . numbers . organizationsSize = NumberUtils . roundNumber ( data [ 8 ] ) ;
}
if ( data [ 9 ] [ 1 ] && data [ 9 ] [ 1 ] . length > 0 && data [ 9 ] [ 1 ] [ 0 ] . filterId == 'relfunder' && data [ 9 ] [ 1 ] [ 0 ] . values ) {
let queriedFunders = data [ 9 ] [ 1 ] [ 0 ] . values ;
queriedFunders . forEach ( queriedFunder = > {
if ( ! mergedFundersSet . has ( queriedFunder . id ) ) {
mergedFundersSet . add ( queriedFunder . id ) ;
}
} ) ;
}
this . numbers . mergedFundersSize = NumberUtils . roundNumber ( mergedFundersSet . size ) ;
}
if ( data . hasOwnProperty ( "software" ) && data [ 'software' ] > 0 ) {
this . numbers . softwareSize = NumberUtils . roundNumber ( data [ 'software' ] ) ;
) , err = > {
this . handleError ( 'Error getting numbers' , err ) ;
} ) ;
} else {
this . subs . push ( this . groupedRequestsService . home ( ) . subscribe ( ( data : any [ ] ) = > {
if ( data ) {
if ( data . hasOwnProperty ( "publications" ) && data [ 'publications' ] > 0 ) {
this . numbers . publicationsSize = NumberUtils . roundNumber ( data [ 'publications' ] ) ;
}
if ( data . hasOwnProperty ( "datasets" ) && data [ 'datasets' ] > 0 ) {
this . numbers . datasetsSize = NumberUtils . roundNumber ( data [ 'datasets' ] ) ;
}
if ( data . hasOwnProperty ( "datasetsInterlinked" ) && data [ 'datasetsInterlinked' ] > 0 ) {
this . numbers . datasetsLinkedSize = NumberUtils . roundNumber ( data [ 'datasetsInterlinked' ] ) ;
}
if ( data . hasOwnProperty ( "software" ) && data [ 'software' ] > 0 ) {
this . numbers . softwareSize = NumberUtils . roundNumber ( data [ 'software' ] ) ;
}
if ( data . hasOwnProperty ( "softwareInterlinked" ) && data [ 'softwareInterlinked' ] > 0 ) {
this . numbers . softwareLinkedSize = NumberUtils . roundNumber ( data [ 'softwareInterlinked' ] ) ;
}
if ( data . hasOwnProperty ( "other" ) && data [ 'other' ] > 0 ) {
this . numbers . otherSize = NumberUtils . roundNumber ( data [ 'other' ] ) ;
}
if ( data . hasOwnProperty ( "projects" ) && data [ 'projects' ] > 0 ) {
this . numbers . projectsSize = NumberUtils . roundNumber ( data [ 'projects' ] ) ;
}
if ( data . hasOwnProperty ( "funders" ) && data [ 'funders' ] > 0 ) {
this . numbers . mergedFundersSize = NumberUtils . roundNumber ( data [ 'funders' ] ) ;
}
if ( data . hasOwnProperty ( "datasources" ) && data [ 'datasources' ] > 0 ) {
this . numbers . datasourcesSize = NumberUtils . roundNumber ( data [ 'datasources' ] ) ;
}
if ( data . hasOwnProperty ( "organizations" ) && data [ 'organizations' ] > 0 ) {
this . numbers . organizationsSize = NumberUtils . roundNumber ( data [ 'organizations' ] ) ;
}
}
if ( data . hasOwnProperty ( "softwareInterlinked" ) && data [ 'softwareInterlinked' ] > 0 ) {
this . numbers . softwareLinkedSize = NumberUtils . roundNumber ( data [ 'softwareInterlinked' ] ) ;
}
if ( data . hasOwnProperty ( "other" ) && data [ 'other' ] > 0 ) {
this . numbers . otherSize = NumberUtils . roundNumber ( data [ 'other' ] ) ;
}
if ( data . hasOwnProperty ( "projects" ) && data [ 'projects' ] > 0 ) {
this . numbers . projectsSize = NumberUtils . roundNumber ( data [ 'projects' ] ) ;
}
if ( data . hasOwnProperty ( "funders" ) && data [ 'funders' ] > 0 ) {
this . numbers . mergedFundersSize = NumberUtils . roundNumber ( data [ 'funders' ] ) ;
}
if ( data . hasOwnProperty ( "datasources" ) && data [ 'datasources' ] > 0 ) {
this . numbers . datasourcesSize = NumberUtils . roundNumber ( data [ 'datasources' ] ) ;
}
if ( data . hasOwnProperty ( "organizations" ) && data [ 'organizations' ] > 0 ) {
this . numbers . organizationsSize = NumberUtils . roundNumber ( data [ 'organizations' ] ) ;
}
}
this . results . emit ( this . numbers ) ;
} , err = > {
this . handleError ( 'Error getting numbers' , err ) ;
} ) ) ;
this . results . emit ( this . numbers ) ;
} , err = > {
this . handleError ( 'Error getting numbers' , err ) ;
} ) ) ;
}
}
ngOnDestroy() {