make the rule to apply year filter more generic, but exclude "indi_pub_downloads_year.year" according to #8135

This commit is contained in:
argirok 2022-10-17 14:22:07 +03:00
parent 1e2a7cff85
commit ef45a417b0
1 changed files with 4 additions and 3 deletions

View File

@ -391,7 +391,7 @@ export class IndicatorUtils {
let filterApplied:boolean = false;
let queryIndex = 0;
for (let queries of this.getQueryObjectName(newJsonObject)?newJsonObject[this.getDescriptionObjectName(newJsonObject)][this.getQueryObjectName(newJsonObject)]:newJsonObject[this.getDescriptionObjectName(newJsonObject)]) {
/*Chart with Named Queries*/
if(queries["query"]["name"] && !queries["query"]["select"]){
if(queries["query"]["name"].indexOf("monitor.")==-1 || !queries["query"]["parameters"]){
@ -462,12 +462,13 @@ export class IndicatorUtils {
if (!queries["query"]["filters"] || queries["query"]["filters"].length == 0) {
queries["query"]["filters"] = [];
}
/*Chart with proper json object*/
//apply the filter in any select fields
for (let select of queries["query"]["select"]) {
let field = select["field"];
let filterString = IndicatorFilterUtils.getFilter(field&&field.length > 0? field.split(".")[0]:"",filterType);
let filterString = IndicatorFilterUtils.getFilter(select["field"],filterType);
if (filterString) {
let filter = JSON.parse(filterString);
//check if filter already exists
let filterposition = IndicatorFilterUtils.filterIndexOf(filter, queries["query"]["filters"]);
if (filterposition) {
if (queries["query"]["filters"][filterposition.filter]['groupFilters'][filterposition.groupFilter]["values"][0] != filter['groupFilters'][0]["values"][0].replace(ChartHelper.prefix + filterType + ChartHelper.suffix, filterValue)) {