diff --git a/frontend/src/metabase/lib/expressions/index.js b/frontend/src/metabase/lib/expressions/index.js index c6d40065628e439416c42d8c7f8fa25b9fefbb6f..df58a0562d0044b6bbda2fa829206b3d9ee52a55 100644 --- a/frontend/src/metabase/lib/expressions/index.js +++ b/frontend/src/metabase/lib/expressions/index.js @@ -1,7 +1,7 @@ import _ from "underscore"; import { mbqlEq } from "../query/util"; -import { titleize } from "metabase/lib/formatting"; +import { titleize } from "../formatting"; export const VALID_OPERATORS = new Set([ '+', diff --git a/frontend/src/metabase/lib/expressions/parser.js b/frontend/src/metabase/lib/expressions/parser.js index 3b5004c569e3f6940729a5b4534e83d599227e7f..7281b75c527ac28cb4c9d8b955628a2dedb67907 100644 --- a/frontend/src/metabase/lib/expressions/parser.js +++ b/frontend/src/metabase/lib/expressions/parser.js @@ -69,13 +69,14 @@ class ExpressionsParser extends Parser { const op = $.CONSUME(AdditiveOperator); const rhsVal = $.SUBRULE2($.multiplicationExpression, [outsideAggregation]); + // collapse multiple consecutive operators into a single MBQL statement if (Array.isArray(value) && value[0] === op.image) { value.push(rhsVal); } else { value = [op.image, value, rhsVal] } }); - return value + return value; }); $.RULE("multiplicationExpression", (outsideAggregation) => { @@ -84,13 +85,14 @@ class ExpressionsParser extends Parser { const op = $.CONSUME(MultiplicativeOperator); const rhsVal = $.SUBRULE2($.atomicExpression, [outsideAggregation]); + // collapse multiple consecutive operators into a single MBQL statement if (Array.isArray(value) && value[0] === op.image) { value.push(rhsVal); } else { value = [op.image, value, rhsVal] } }); - return value + return value; }); $.RULE("aggregationOrMetricExpression", (outsideAggregation) => { diff --git a/webpack.config.js b/webpack.config.js index 069baf40ae88277ac076b407119c7356dd4ed961..7b06d81d11d4a911f3c35e120b4cedbd3dc4019c 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,4 @@ /*eslint-env node */ -"use strict"; require("babel-register"); require("babel-polyfill");