Fix sql calculations

This commit is contained in:
Adria Navarro 2024-12-17 10:47:43 +01:00
parent 7932ee7620
commit 499d3f2041
1 changed files with 12 additions and 10 deletions

View File

@ -169,20 +169,22 @@ export async function buildSqlFieldList(
fields = Object.keys(helpers.views.basicFields(source))
.filter(f => table.schema[f].type !== FieldType.LINK)
.map(c => `${table.name}.${c}`)
if (!helpers.views.isCalculationView(source)) {
fields.push(
...getRequiredFields(
{
...table,
primaryDisplay: source.primaryDisplay || table.primaryDisplay,
},
fields
)
)
}
} else {
fields = extractRealFields(source)
}
fields.push(
...getRequiredFields(
{
...table,
primaryDisplay: source.primaryDisplay || table.primaryDisplay,
},
fields
)
)
for (const field of Object.values(table.schema)) {
if (field.type !== FieldType.LINK || !relationships || !field.tableId) {
continue