Merge Angular 16 Irish Monitor to develop #33
|
@ -393,11 +393,81 @@ export class IndicatorUtils {
|
|||
}
|
||||
|
||||
public getFullUrlWithFilters(stakeholder: Stakeholder, indicatorPath: IndicatorPath, fundingL0: string = null, startYear: string = null, endYear: string = null, coFunded: boolean = false, foslvl1:string[]=[], foslvl2:string[]=[], publiclyFunded: "all"| "true"| "false"= "all" ): string {
|
||||
let filterSubtitleText = [];
|
||||
indicatorPath.filtersApplied = 0;
|
||||
let replacedUrl = indicatorPath.chartObject ? indicatorPath.chartObject : indicatorPath.url;
|
||||
if (stakeholder.statsProfile) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + this.statsProfileParameter + ChartHelper.suffix).join(stakeholder.statsProfile);
|
||||
}
|
||||
if (fundingL0) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'fundingL0', fundingL0);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
filterSubtitleText.push( "Funding level 0: " ) ;
|
||||
}
|
||||
}
|
||||
if (startYear) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'start_year', startYear);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (endYear) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'end_year', endYear);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if(startYear || endYear) {
|
||||
filterSubtitleText.push(startYear && endYear ? (startYear + ' - ' + endYear) : (endYear ? ('until ' + endYear) : ''));
|
||||
}
|
||||
if (coFunded) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'co-funded', coFunded);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
filterSubtitleText.push( "Co-funded: " + (coFunded?'yes':'no') ) ;
|
||||
}
|
||||
}
|
||||
if (publiclyFunded && publiclyFunded !="all") {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'publicly-funded', publiclyFunded);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
filterSubtitleText.push( "Publicly funded: " + (publiclyFunded?'yes':'no') ) ;
|
||||
}
|
||||
}
|
||||
if (foslvl1) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'foslvl1', foslvl1);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied +=filterResults.filtersApplied?foslvl1.length:0;
|
||||
}
|
||||
}
|
||||
if (foslvl2) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'foslvl2', foslvl2);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied?foslvl2.length:0;
|
||||
}
|
||||
}
|
||||
if((foslvl1 && foslvl1.length > 0) || (foslvl2 && foslvl2.length > 0)){
|
||||
filterSubtitleText.push( "Field of Science: " + foslvl1.join(', ') + ( foslvl1.length > 0 && foslvl2.length > 0? ', ': '') + foslvl2.join(", ") ) ;
|
||||
}
|
||||
|
||||
//For numbers
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_id' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_id));
|
||||
}
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_name' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_name' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_name));
|
||||
}
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_shortName));
|
||||
}
|
||||
if (indicatorPath.parameters) {
|
||||
Object.keys(indicatorPath.parameters).forEach(key => {
|
||||
let replacedValue = indicatorPath.parameters[key];
|
||||
|
@ -420,70 +490,12 @@ export class IndicatorUtils {
|
|||
if (key == "index_shortName") {
|
||||
replacedValue = stakeholder.index_shortName.toLowerCase();
|
||||
}
|
||||
|
||||
if (key == "subtitle" && filterSubtitleText.length > 0) {
|
||||
replacedValue = replacedValue + ' - Filter by: ('+filterSubtitleText.join(", ") + ')';
|
||||
}
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + key + ChartHelper.suffix).join(replacedValue)
|
||||
});
|
||||
}
|
||||
if (fundingL0) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'fundingL0', fundingL0);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (startYear) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'start_year', startYear);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (endYear) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'end_year', endYear);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (coFunded) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'co-funded', endYear);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (publiclyFunded && publiclyFunded !="all") {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'publicly-funded', publiclyFunded);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied;
|
||||
}
|
||||
}
|
||||
if (foslvl1) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'foslvl1', foslvl1);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied +=filterResults.filtersApplied?foslvl1.length:0;
|
||||
}
|
||||
}
|
||||
if (foslvl2) {
|
||||
if (indicatorPath.source == "stats-tool" && indicatorPath.chartObject) {
|
||||
let filterResults = this.addFilter(replacedUrl, 'foslvl2', foslvl2);
|
||||
replacedUrl = filterResults.url;
|
||||
indicatorPath.filtersApplied += filterResults.filtersApplied?foslvl2.length:0;
|
||||
}
|
||||
}
|
||||
|
||||
//For numbers
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_id' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_id' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_id));
|
||||
}
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_name' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_name' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_name));
|
||||
}
|
||||
if (replacedUrl.indexOf(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix) != -1) {
|
||||
replacedUrl = replacedUrl.split(ChartHelper.prefix + 'index_shortName' + ChartHelper.suffix).join(encodeURIComponent(stakeholder.index_shortName));
|
||||
}
|
||||
return (indicatorPath.chartObject ? indicatorPath.url + encodeURIComponent(replacedUrl) : replacedUrl);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue