diff --git a/frontend/src/metabase/lib/expressions/process.js b/frontend/src/metabase/lib/expressions/process.js index 45032cf68b99565b3a790477b04b7c89710ebbf6..508b4b432b32355e020bbb0eeef9dc99d7cd2eed 100644 --- a/frontend/src/metabase/lib/expressions/process.js +++ b/frontend/src/metabase/lib/expressions/process.js @@ -21,13 +21,12 @@ export function processSource(options) { // COMPILE if (parserErrors.length > 0) { - console.log("parse errors", parserErrors); compileError = parserErrors; } else { try { expression = compile({ cst, tokenVector, ...options }); } catch (e) { - console.log("compile error", e); + console.warn("compile error", e); compileError = e; } } @@ -40,9 +39,8 @@ export function processSource(options) { tokenVector, ...options, })); - console.log("suggestions", suggestions); } catch (e) { - console.log("suggest error", e); + console.warn("suggest error", e); } } @@ -50,7 +48,7 @@ export function processSource(options) { try { syntaxTree = syntax({ cst, tokenVector, ...options }); } catch (e) { - console.log("syntax error", e); + console.warn("syntax error", e); } return { diff --git a/frontend/src/metabase/query_builder/components/AggregationPopover.jsx b/frontend/src/metabase/query_builder/components/AggregationPopover.jsx index 02f36932861a794a3ae495f71e5aecf725284286..f906f35cd1ba5e10b312c66702c63f89f4e3918d 100644 --- a/frontend/src/metabase/query_builder/components/AggregationPopover.jsx +++ b/frontend/src/metabase/query_builder/components/AggregationPopover.jsx @@ -195,7 +195,7 @@ export default class AggregationPopover extends Component { showCustom = false; showMetrics = false; } - if (table.database.hasFeature("expression-aggregations")) { + if (!table.database.hasFeature("expression-aggregations")) { showCustom = false; } diff --git a/frontend/test/metabase/scenarios/question/new.cy.spec.js b/frontend/test/metabase/scenarios/question/new.cy.spec.js index 49ab02a18bb375dc416b80464213de16e8fc822c..23a8bbaf06c3d6738e9a2f635db77b974f0b8a0c 100644 --- a/frontend/test/metabase/scenarios/question/new.cy.spec.js +++ b/frontend/test/metabase/scenarios/question/new.cy.spec.js @@ -38,11 +38,20 @@ describe("scenarios > question > new", () => { cy.contains("37.65"); }); - it.skip("should show `Custom Expression` in orders metrics (Issue #12899)", () => { + it("should allow using `Custom Expression` in orders metrics", () => { // go straight to "orders" in custom questions cy.visit("/question/new?database=1&table=2&mode=notebook"); cy.findByText("Summarize").click(); - popover().contains("Custom Expression"); + popover() + .contains("Custom Expression") + .click(); + popover().within(() => { + cy.get("[contentEditable=true]").type("2 * Max([Total])"); + cy.findByPlaceholderText("Name (required)").type("twice max total"); + cy.findByText("Done").click(); + }); + cy.findByText("Visualize").click(); + cy.findByText("604.96"); }); }); });