[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot]
2025-09-27 11:14:05 +00:00
committed by GitHub
parent 0ed0fe427d
commit d1d48e992a
2 changed files with 6 additions and 4 deletions

View File

@@ -1000,7 +1000,9 @@ describe('Type conversions', () => {
);
// The SQL should use cat_group instead of "group" in the join condition
expect(result.sql).toMatch(/category_groups\d+\.id = categories\d+\.cat_group/);
expect(result.sql).toMatch(
/category_groups\d+\.id = categories\d+\.cat_group/,
);
expect(result.sql).not.toMatch(/categories\d+\."group"/);
});
});

View File

@@ -823,11 +823,11 @@ function compileJoins(state, tableRef, internalTableFilters, schemaConfig) {
// Apply field mapping for join field (e.g., 'group' -> 'cat_group')
const resolvedJoinField = (() => {
const views = schemaConfig?.views || {};
// We need to find the actual table name that joinTable refers to
// joinTable could be either a table name (first level) or a tableId (deeper levels)
let actualTableName = joinTable;
// If joinTable looks like a table ID (contains numbers), find the actual table name
if (typeof joinTable === 'string' && joinTable.match(/\d+$/)) {
// Find the table name by looking for a path with this tableId
@@ -838,7 +838,7 @@ function compileJoins(state, tableRef, internalTableFilters, schemaConfig) {
}
}
}
// The joinField belongs to actualTableName (the table we're joining FROM)
if (views[actualTableName] && views[actualTableName].fields) {
return views[actualTableName].fields[joinField] || joinField;