[angular-16-irish-monitor | DONE | CHANGED] Indicator utils: update the way we extract indicator index fields and add the parameters
This commit is contained in:
parent
c6dd26dcee
commit
fe0860d41a
|
@ -781,14 +781,11 @@ export class IndicatorUtils {
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
for (let gfilter of filter["groupFilters"]) {
|
||||||
//ignore field No Of Funders
|
//ignore field No Of Funders
|
||||||
if (gfilter["field"].indexOf(" funder") != -1 && gfilter["field"].indexOf(" funders") == -1) {//new statistcs schema
|
if (gfilter["field"].indexOf(" funder") != -1 && gfilter["field"].indexOf(" funders") == -1) {//new statistcs schema
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
|
||||||
indicatorPath.parameters["index_name"] = stakeholder.index_name;
|
|
||||||
} else if (gfilter["field"].indexOf(".funder") != -1) {
|
} else if (gfilter["field"].indexOf(".funder") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
|
||||||
indicatorPath.parameters["index_name"] = stakeholder.index_name;
|
|
||||||
} else if (gfilter["field"].indexOf(".funder.id") != -1) {
|
} else if (gfilter["field"].indexOf(".funder.id") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_shortName" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
|
||||||
indicatorPath.parameters["index_shortName"] = stakeholder.index_shortName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,11 +806,9 @@ export class IndicatorUtils {
|
||||||
for (let filter of query["query"]["filters"]) {
|
for (let filter of query["query"]["filters"]) {
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
for (let gfilter of filter["groupFilters"]) {
|
||||||
if (gfilter["field"].indexOf(".context.name") != -1) {
|
if (gfilter["field"].indexOf(".context.name") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
|
||||||
indicatorPath.parameters["index_name"] = stakeholder.index_name;
|
|
||||||
} else if (gfilter["field"].indexOf(".context.id") != -1) {
|
} else if (gfilter["field"].indexOf(".context.id") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_shortName" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
|
||||||
indicatorPath.parameters["index_shortName"] = stakeholder.index_shortName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -836,17 +831,28 @@ export class IndicatorUtils {
|
||||||
for (let filter of query["query"]["filters"]) {
|
for (let filter of query["query"]["filters"]) {
|
||||||
for (let gfilter of filter["groupFilters"]) {
|
for (let gfilter of filter["groupFilters"]) {
|
||||||
if (gfilter["field"].indexOf(".organization.name") != -1) {
|
if (gfilter["field"].indexOf(".organization.name") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_name" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
|
||||||
indicatorPath.parameters["index_name"] = stakeholder.index_name;
|
|
||||||
} else if (gfilter["field"].indexOf(".organization.id") != -1) {
|
} else if (gfilter["field"].indexOf(".organization.id") != -1) {
|
||||||
gfilter["values"][0] = ChartHelper.prefix + "index_shortName" + ChartHelper.suffix;
|
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
|
||||||
indicatorPath.parameters["index_shortName"] = stakeholder.index_shortName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private replaceIndexValues(currentValue, stakeholder, parameters ){
|
||||||
|
if(currentValue == stakeholder.index_name){
|
||||||
|
parameters["index_name"] = stakeholder.index_name;
|
||||||
|
return ChartHelper.prefix + "index_name" + ChartHelper.suffix;
|
||||||
|
}else if(currentValue == stakeholder.index_id){
|
||||||
|
parameters["index_id"] = stakeholder.index_id;
|
||||||
|
return ChartHelper.prefix + "index_id" + ChartHelper.suffix;
|
||||||
|
}else if(currentValue == stakeholder.index_shortName) {
|
||||||
|
parameters["index_shortName"] = stakeholder.index_shortName;
|
||||||
|
return ChartHelper.prefix + "index_shortName" + ChartHelper.suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
private extractStartYear(obj, indicatorPath: IndicatorPath) {
|
private extractStartYear(obj, indicatorPath: IndicatorPath) {
|
||||||
let start_year;
|
let start_year;
|
||||||
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
for (let query of obj[this.getDescriptionObjectName(obj)][this.getQueryObjectName(obj)]) {
|
||||||
|
|
Loading…
Reference in New Issue