[angular-16-irish-monitor | DONE | CHANGED] replace value of a field only if it matches with one of the profile index values, if not ignore it

This commit is contained in:
argirok 2024-01-08 14:29:16 +02:00
parent 4f0c8ae5e9
commit 010709202b
1 changed files with 25 additions and 18 deletions

View File

@ -781,12 +781,13 @@ export class IndicatorUtils {
for (let filter of query["query"]["filters"]) {
for (let gfilter of filter["groupFilters"]) {
//ignore field No Of Funders
if (gfilter["field"].indexOf(" funder") != -1 && gfilter["field"].indexOf(" funders") == -1) {//new statistcs schema
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
} else if (gfilter["field"].indexOf(".funder") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
} else if (gfilter["field"].indexOf(".funder.id") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
if(replacedValue) { // don't proceed in replacement if no replaced value matches
if ((gfilter["field"].indexOf(" funder") != -1 && gfilter["field"].indexOf(" funders") == -1 ) ||
(gfilter["field"].indexOf(".funder") != -1) ||
(gfilter["field"].indexOf(".funder.id") != -1)) {
gfilter["values"][0] = replacedValue;
}
}
}
}
@ -806,10 +807,12 @@ export class IndicatorUtils {
}
for (let filter of query["query"]["filters"]) {
for (let gfilter of filter["groupFilters"]) {
if (gfilter["field"].indexOf(".context.name") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
} else if (gfilter["field"].indexOf(".context.id") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
if(replacedValue) { // don't proceed in replacement if no replaced value matches
if ((gfilter["field"].indexOf(".context.name") != -1)
|| (gfilter["field"].indexOf(".context.id") != -1)) {
gfilter["values"][0] = replacedValue;
}
}
}
}
@ -831,10 +834,12 @@ export class IndicatorUtils {
}
for (let filter of query["query"]["filters"]) {
for (let gfilter of filter["groupFilters"]) {
if (gfilter["field"].indexOf(".organization.name") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
} else if (gfilter["field"].indexOf(".organization.id") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
if(replacedValue) { // don't proceed in replacement if no replaced value matches
if ((gfilter["field"].indexOf(".organization.name") != -1)||
(gfilter["field"].indexOf(".organization.id") != -1)) {
gfilter["values"][0] = replacedValue;
}
}
}
}
@ -855,10 +860,12 @@ export class IndicatorUtils {
}
for (let filter of query["query"]["filters"]) {
for (let gfilter of filter["groupFilters"]) {
if (gfilter["field"].indexOf(".datasource.name") != -1 || gfilter["field"].indexOf(".HostedBy datasource") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
} else if (gfilter["field"].indexOf(".datasource.id") != -1) {
gfilter["values"][0] = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters)
let replacedValue = this.replaceIndexValues(gfilter["values"][0], stakeholder, indicatorPath.parameters);
if(replacedValue) { // don't proceed in replacement if no replaced value matches
if ((gfilter["field"].indexOf(".datasource.name") != -1 || gfilter["field"].indexOf(".HostedBy datasource") != -1)||
(gfilter["field"].indexOf(".datasource.id") != -1)) {
gfilter["values"][0] = replacedValue;
}
}
}
}