Browse Source

fix(api): avoid duplicate value in uncategorized group

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3563/head
Pranav C 2 years ago
parent
commit
f86600c56a
  1. 24
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

24
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/BaseModelSqlv2.ts

@ -2445,23 +2445,19 @@ class BaseModelSqlv2 {
qb.orderBy('created_at'); qb.orderBy('created_at');
} }
const nullListQb = qb.clone().whereNull(column.title);
const groupedQb = this.dbDriver.from( const groupedQb = this.dbDriver.from(
this.dbDriver this.dbDriver
.unionAll( .unionAll(
[ [...groupingValues].map((r) => {
this.isSqlite const query = qb.clone();
? this.dbDriver.select().from(nullListQb) if (r === null) {
: nullListQb, query.whereNull(column.title);
...[...groupingValues].map((r) => { } else {
const query = qb.clone().where(column.title, r); query.where(column.title, r);
}
return this.isSqlite
? this.dbDriver.select().from(query) return this.isSqlite ? this.dbDriver.select().from(query) : query;
: query; }),
}),
],
!this.isSqlite !this.isSqlite
) )
.as('__nc_grouped_list') .as('__nc_grouped_list')

Loading…
Cancel
Save