Browse Source

fix: group by has many bt part

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/7146/head
mertmit 12 months ago
parent
commit
165fa45fc2
  1. 18
      packages/nocodb/src/db/BaseModelSqlv2.ts

18
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -4457,10 +4457,24 @@ class BaseModelSqlv2 {
(d) => d[col.id] && Object.keys(d[col.id]), (d) => d[col.id] && Object.keys(d[col.id]),
); );
if (btData) { if (btData) {
if (typeof btData[col.id] === 'object') {
for (const k of Object.keys(btData[col.id])) { for (const k of Object.keys(btData[col.id])) {
const btAlias = idToAliasMap[k]; const btAlias = idToAliasMap[k];
if (!btAlias) { if (!btAlias) {
idToAliasPromiseMap[k] = Column.get({ colId: k }).then((col) => { idToAliasPromiseMap[k] = Column.get({ colId: k }).then(
(col) => {
return col.title;
},
);
}
}
} else {
// Has Many BT
const btAlias = idToAliasMap[col.id];
if (!btAlias) {
idToAliasPromiseMap[col.id] = Column.get({
colId: col.id,
}).then((col) => {
return col.title; return col.title;
}); });
} }
@ -4480,7 +4494,7 @@ class BaseModelSqlv2 {
const alias = idToAliasMap[key]; const alias = idToAliasMap[key];
if (alias) { if (alias) {
if (btMap[key]) { if (btMap[key]) {
if (value) { if (value && typeof value === 'object') {
const tempObj = {}; const tempObj = {};
Object.entries(value).forEach(([k, v]) => { Object.entries(value).forEach(([k, v]) => {
const btAlias = idToAliasMap[k]; const btAlias = idToAliasMap[k];

Loading…
Cancel
Save