Skip to content
Snippets Groups Projects
Unverified Commit a48893b4 authored by Mahatthana (Kelvin) Nomsawadi's avatar Mahatthana (Kelvin) Nomsawadi Committed by GitHub
Browse files

Fix cannot select fields for double aggregations (#27559)

* Fix double aggregation not working on some fields.

This fix adds make sure the table field source is `fields` as this is
done in the previous version before we changed it in PR#25267 which
introduces the bug in issue#27462

* Add a reproduction

* Address review: Improve test readability
parent c8f487b1
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ function getFieldsForSourceQueryTable(
const virtualField = createVirtualField({
...column,
id,
source: "fields",
query: originalQuery,
metadata,
});
......
......@@ -120,6 +120,7 @@ export const AccordionListCell = ({
content = (
<ListCellItem
data-testid={itemTestId}
aria-label={name}
role="option"
aria-selected={isSelected}
isClickable={isClickable}
......
......@@ -245,6 +245,7 @@ const ActionButton = ({
onClick,
...props
}) => {
const label = large ? title : null;
const button = (
<ColorButton
icon={icon}
......@@ -254,9 +255,10 @@ const ActionButton = ({
iconVertical={large}
iconSize={large ? 18 : 14}
onClick={onClick}
aria-label={label}
{...props}
>
{large ? title : null}
{label}
</ColorButton>
);
......
import { visitQuestionAdhoc, restore, popover } from "__support__/e2e/helpers";
import { SAMPLE_DB_ID } from "__support__/e2e/cypress_data";
import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database";
const { PRODUCTS_ID, PRODUCTS } = SAMPLE_DATABASE;
describe("issue 27462", () => {
beforeEach(() => {
restore();
cy.signInAsAdmin();
});
it("should be able to select field when double aggregating metabase#27462", () => {
const questionDetails = {
dataset_query: {
database: SAMPLE_DB_ID,
type: "query",
query: {
"source-table": PRODUCTS_ID,
aggregation: [["count"]],
breakout: [["field", PRODUCTS.CATEGORY, null]],
},
},
display: "table",
visualization_settings: {},
};
visitQuestionAdhoc(questionDetails, { mode: "notebook" });
cy.button("Summarize").click();
cy.findByRole("option", { name: "Sum of ..." }).click();
popover().within(() => {
cy.findByRole("option", { name: "Count" }).click();
});
cy.button("Visualize").click();
cy.findByText("200").should("be.visible");
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment