mirror of
https://github.com/nocodb/nocodb.git
synced 2026-02-01 23:48:33 +00:00
fix oss test for "will create a formula referencing lookup referencing formula"
This commit is contained in:
@@ -255,12 +255,23 @@ export const selectObject = (baseModel: IBaseModelSqlV2, logger: Logger) => {
|
||||
validateFormula,
|
||||
aliasToColumnBuilder,
|
||||
);
|
||||
qb.select(
|
||||
baseModel.dbDriver.raw(`?? as ??`, [
|
||||
selectQb.builder,
|
||||
getAs(column),
|
||||
]),
|
||||
);
|
||||
|
||||
if ('toQuery' in selectQb.builder) {
|
||||
const selectQbQuery = selectQb.builder.toQuery();
|
||||
qb.select(
|
||||
baseModel.dbDriver.raw(
|
||||
`${selectQbQuery.replaceAll('?', '\\?')} as ??`,
|
||||
[getAs(column)],
|
||||
),
|
||||
);
|
||||
} else {
|
||||
qb.select(
|
||||
baseModel.dbDriver.raw(`?? as ??`, [
|
||||
selectQb.builder,
|
||||
getAs(column),
|
||||
]),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
logger.log(e);
|
||||
// return dummy select
|
||||
|
||||
@@ -665,12 +665,13 @@ export const lookupOrLtarBuilder =
|
||||
break;
|
||||
}
|
||||
|
||||
if (selectQb)
|
||||
if (selectQb) {
|
||||
return {
|
||||
builder:
|
||||
typeof selectQb === 'function'
|
||||
? selectQb
|
||||
: knex.raw(selectQb as any).wrap('(', ')'),
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -530,6 +530,14 @@ export async function initFormulaLookupColumns(context: ITestContext) {
|
||||
relationColumnId: t3_OO_t1_Ltar.id,
|
||||
});
|
||||
|
||||
// referencing using formula field so it's populated in chunkList
|
||||
await createColumn(context.context, context.tables.table3, {
|
||||
title: 'table1FormulaTitleFormula',
|
||||
uidt: UITypes.Formula,
|
||||
formula: `{table1FormulaTitle}`,
|
||||
formula_raw: `{table1FormulaTitle}`,
|
||||
});
|
||||
|
||||
for (const attr of t1SupportingLookupColumns) {
|
||||
await createLookupColumn(context.context, {
|
||||
base: context.base,
|
||||
|
||||
@@ -303,6 +303,14 @@ function formulaLookupLtarTests() {
|
||||
expect(parts[1]).to.contain(token);
|
||||
}
|
||||
|
||||
// referencing using formula field so it's populated in chunkList
|
||||
await createColumn(_context, _tables.table1, {
|
||||
title: 'table2FormulaTitleFormula',
|
||||
uidt: UITypes.Formula,
|
||||
formula: `{table2FormulaTitle}`,
|
||||
formula_raw: `{table2FormulaTitle}`,
|
||||
});
|
||||
|
||||
const t1Rows = await chunkListRow({
|
||||
base: _base,
|
||||
table: _tables.table1,
|
||||
@@ -318,9 +326,9 @@ function formulaLookupLtarTests() {
|
||||
table: _tables.table3,
|
||||
pks: [1, 2, 3, 4, 5, 6].map((k) => `${k}`),
|
||||
});
|
||||
expect(t1Rows[0].table2FormulaTitle).to.eq('T2_001?');
|
||||
expect(t1Rows[0].table2FormulaTitleFormula).to.eq('T2_001?');
|
||||
expect(t2Rows[0].table1FormulaTitleConcat).to.contain('T1_001?');
|
||||
expect(t3Rows[0].table1FormulaTitle).to.eq('T1_001?');
|
||||
expect(t3Rows[0].table1FormulaTitleFormula).to.eq('T1_001?');
|
||||
});
|
||||
|
||||
it('will create a formula column assigned as display value accessed through ltar field', async () => {
|
||||
|
||||
Reference in New Issue
Block a user