mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
fix(Jinja): Emit time grain to table charts even if they don't have a temporal column (#32871)
(cherry picked from commit ab22bb1878)
This commit is contained in:
committed by
Michael S. Molina
parent
56f6e1196c
commit
f27bf9ea64
@@ -198,11 +198,6 @@ const buildQuery: BuildQuery<TableChartFormData> = (
|
||||
(ownState.currentPage ?? 0) * (ownState.pageSize ?? 0);
|
||||
}
|
||||
|
||||
if (!temporalColumn) {
|
||||
// This query is not using temporal column, so it doesn't need time grain
|
||||
extras.time_grain_sqla = undefined;
|
||||
}
|
||||
|
||||
let queryObject = {
|
||||
...baseQueryObject,
|
||||
columns,
|
||||
|
||||
@@ -148,14 +148,5 @@ describe('plugin-chart-table', () => {
|
||||
expect(queries[1].extras?.time_grain_sqla).toEqual(TimeGranularity.MONTH);
|
||||
expect(queries[1].extras?.where).toEqual("(status IN ('In Process'))");
|
||||
});
|
||||
it('should not include time_grain_sqla in extras if temporal colum is not used and keep the rest', () => {
|
||||
const { queries } = buildQuery(extraQueryFormData);
|
||||
// Extras in regular query
|
||||
expect(queries[0].extras?.time_grain_sqla).toBeUndefined();
|
||||
expect(queries[0].extras?.where).toEqual("(status IN ('In Process'))");
|
||||
// Extras in summary query
|
||||
expect(queries[1].extras?.time_grain_sqla).toBeUndefined();
|
||||
expect(queries[1].extras?.where).toEqual("(status IN ('In Process'))");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user