Skip to content

Commit

Permalink
fix: allow repeated use of d2:hasValue in a single expression
Browse files Browse the repository at this point in the history
  • Loading branch information
superskip committed Sep 15, 2023
1 parent 9b120f4 commit 7a247ee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion d2-tracker/dhis2.angular.services.js
Original file line number Diff line number Diff line change
Expand Up @@ -1841,7 +1841,7 @@ var d2Services = angular.module('d2Services', ['ngResource'])
//d2:hasValue('variableName') to avoid the further replacement, and make sure the correct input is fed into d2:hasValue.
var avoidReplacementFunctions = ['d2:hasValue','d2:lastEventDate', 'd2:count', 'd2:countIfZeroPos', 'd2:countIfValue'];
avoidReplacementFunctions.forEach(avoidReplaceFunction => {
expression = expression.replace( new RegExp("(" + avoidReplaceFunction + "\\() *[A#CV]\\{([\\w \\-\\_\\.]+)\\}(.*)\\)" ), "$1'$2'$3\)");
expression = expression.replaceAll( new RegExp("(" + avoidReplaceFunction + "\\() *[A#CV]\\{([\\w \\-\\_\\.]+)\\}", 'g'), "$1'$2'");
});

//Check if the expression contains program rule variables at all(any curly braces):
Expand Down

0 comments on commit 7a247ee

Please sign in to comment.