From 09e2fba5f129e8ace686c226b0ef5dc59232bae3 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:07:43 +0000 Subject: [PATCH 1/5] fix(nocodb): groupby doesn't work if formula field dataType is numeric nocodb/nocodb#7382 --- packages/nocodb/src/db/conditionV2.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index be7e3eb2c1..0e7bf6ad89 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -1,4 +1,5 @@ import { + FormulaDataTypes, isDateMonthFormat, isNumericCol, RelationTypes, @@ -447,7 +448,16 @@ const parseConditionV2 = async ( ).builder; return parseConditionV2( baseModelSqlv2, - new Filter({ ...filter, value: knex.raw('?', [filter.value]) } as any), + new Filter({ + ...filter, + value: knex.raw('?', [ + // convert value to number if formulaDataType if numeric + formula.getParsedTree()?.dataType === FormulaDataTypes.NUMERIC && + !isNaN(+filter.value) + ? +filter.value + : filter.value || null, // in gp_null value is undefined + ]), + } as any), aliasCount, alias, builder, From 70d2d43b20f3c4493440c67b567759f47ea28a6a Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:07:44 +0000 Subject: [PATCH 2/5] fix(nc-gui): group rows update issue --- packages/nc-gui/components/smartsheet/grid/GroupBy.vue | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index 20c9215702..b76fddb217 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -72,7 +72,7 @@ const findAndLoadSubGroup = (key: any) => { if (grp.nested) { if (!grp.children?.length) props.loadGroups({}, grp) } else { - if (!grp.rows?.length) props.loadGroupData(grp) + if (!grp.rows?.length || grp.count !== grp.rows?.length) props.loadGroupData(grp) } } } @@ -258,7 +258,9 @@ const shouldRenderCell = (column) =>
-
{{ grp.column.title }}
+
+ {{ grp.column.title }} +
({{ $t('datatype.Count') }}: {{ grp.count }})
From 5ff3a251ce2844358e22bd44018184e28f7fc034 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:07:44 +0000 Subject: [PATCH 3/5] fix(nocodb): PR review changes --- packages/nocodb/src/db/conditionV2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index 0e7bf6ad89..9ab45c1634 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -455,7 +455,7 @@ const parseConditionV2 = async ( formula.getParsedTree()?.dataType === FormulaDataTypes.NUMERIC && !isNaN(+filter.value) ? +filter.value - : filter.value || null, // in gp_null value is undefined + : filter.value ?? null, // in gp_null value is undefined ]), } as any), aliasCount, From dc22e07e35ea8499f2d570aa35ae0043011d139f Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:07:44 +0000 Subject: [PATCH 4/5] fix(nc-gui): force load group data if grp count is not equal to grp rows --- packages/nc-gui/components/smartsheet/grid/GroupBy.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index b76fddb217..86f752c41d 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -72,7 +72,9 @@ const findAndLoadSubGroup = (key: any) => { if (grp.nested) { if (!grp.children?.length) props.loadGroups({}, grp) } else { - if (!grp.rows?.length || grp.count !== grp.rows?.length) props.loadGroupData(grp) + if (!grp.rows?.length || grp.count !== grp.rows?.length) { + props.loadGroupData(grp, true) + } } } } From 40296d5bd7848ce377abd096f1c69a4ed944fe10 Mon Sep 17 00:00:00 2001 From: Ramesh Mane <101566080+rameshmane7218@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:07:44 +0000 Subject: [PATCH 5/5] fix(nc-gui): small changes --- packages/nc-gui/components/smartsheet/grid/GroupBy.vue | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index 86f752c41d..b76fddb217 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -72,9 +72,7 @@ const findAndLoadSubGroup = (key: any) => { if (grp.nested) { if (!grp.children?.length) props.loadGroups({}, grp) } else { - if (!grp.rows?.length || grp.count !== grp.rows?.length) { - props.loadGroupData(grp, true) - } + if (!grp.rows?.length || grp.count !== grp.rows?.length) props.loadGroupData(grp) } } }