|
|
@ -21,6 +21,7 @@ import { |
|
|
|
validateDateWithUnknownFormat, |
|
|
|
validateDateWithUnknownFormat, |
|
|
|
} from '~/helpers/formulaFnHelper'; |
|
|
|
} from '~/helpers/formulaFnHelper'; |
|
|
|
import FormulaColumn from '~/models/FormulaColumn'; |
|
|
|
import FormulaColumn from '~/models/FormulaColumn'; |
|
|
|
|
|
|
|
import { Source } from '~/models'; |
|
|
|
|
|
|
|
|
|
|
|
const logger = new Logger('FormulaQueryBuilderv2'); |
|
|
|
const logger = new Logger('FormulaQueryBuilderv2'); |
|
|
|
|
|
|
|
|
|
|
@ -76,10 +77,13 @@ async function _formulaQueryBuilder( |
|
|
|
// formula may include double curly brackets in previous version
|
|
|
|
// formula may include double curly brackets in previous version
|
|
|
|
// convert to single curly bracket here for compatibility
|
|
|
|
// convert to single curly bracket here for compatibility
|
|
|
|
// const _tree1 = jsep(_tree.replaceAll('{{', '{').replaceAll('}}', '}'));
|
|
|
|
// const _tree1 = jsep(_tree.replaceAll('{{', '{').replaceAll('}}', '}'));
|
|
|
|
tree = validateFormulaAndExtractTreeWithType( |
|
|
|
tree = validateFormulaAndExtractTreeWithType({ |
|
|
|
_tree.replaceAll('{{', '{').replaceAll('}}', '}'), |
|
|
|
formula: _tree.replaceAll('{{', '{').replaceAll('}}', '}'), |
|
|
|
columns, |
|
|
|
columns, |
|
|
|
); |
|
|
|
clientOrSqlUi: await Source.get(column.source_id).then( |
|
|
|
|
|
|
|
(source) => source.type, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// populate and save parsedTree to column if not exist
|
|
|
|
// populate and save parsedTree to column if not exist
|
|
|
|
if (column) { |
|
|
|
if (column) { |
|
|
|