From b9a04774b0c96253afd4ef301e8e17fe8b0185a3 Mon Sep 17 00:00:00 2001 From: Tom Robinson <tlrobinson@gmail.com> Date: Sun, 11 Dec 2016 22:27:25 -0800 Subject: [PATCH] misc --- frontend/src/metabase/lib/expressions/index.js | 2 +- frontend/src/metabase/lib/expressions/parser.js | 6 ++++-- webpack.config.js | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/src/metabase/lib/expressions/index.js b/frontend/src/metabase/lib/expressions/index.js index c6d40065628..df58a0562d0 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 3b5004c569e..7281b75c527 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 069baf40ae8..7b06d81d11d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,4 @@ /*eslint-env node */ -"use strict"; require("babel-register"); require("babel-polyfill"); -- GitLab