Skip to content

Commit

Permalink
Revert "Sort functions"
Browse files Browse the repository at this point in the history
This reverts commit ab9ce2b.
  • Loading branch information
kamilmielnik committed May 24, 2024
1 parent 42bf50e commit ac5c9e0
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions frontend/src/metabase-lib/aggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,22 @@ export function aggregate(
return ML.aggregate(query, stageIndex, clause);
}

export function aggregateByCount(query: Query): Query {
const stageIndex = -1;
const operators = availableAggregationOperators(query, stageIndex);
const countOperator = operators.find(operator => {
const info = displayInfo(query, stageIndex, operator);
return info.shortName === "count";
});

if (!countOperator) {
return query;
}

const aggregation = aggregationClause(countOperator);
return aggregate(query, stageIndex, aggregation);
}

export function aggregations(
query: Query,
stageIndex: number,
Expand All @@ -58,19 +74,3 @@ export function aggregationColumn(
): ColumnMetadata {
return ML.aggregation_column(query, stageIndex, aggregation);
}

export function aggregateByCount(query: Query): Query {
const stageIndex = -1;
const operators = availableAggregationOperators(query, stageIndex);
const countOperator = operators.find(operator => {
const info = displayInfo(query, stageIndex, operator);
return info.shortName === "count";
});

if (!countOperator) {
return query;
}

const aggregation = aggregationClause(countOperator);
return aggregate(query, stageIndex, aggregation);
}

0 comments on commit ac5c9e0

Please sign in to comment.