From d1d48e992a76cd9348600a1626daf90a17e29814 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Sat, 27 Sep 2025 11:14:05 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- packages/loot-core/src/server/aql/compiler.test.ts | 4 +++- packages/loot-core/src/server/aql/compiler.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/loot-core/src/server/aql/compiler.test.ts b/packages/loot-core/src/server/aql/compiler.test.ts index 9fb50102c5..9614c8bc76 100644 --- a/packages/loot-core/src/server/aql/compiler.test.ts +++ b/packages/loot-core/src/server/aql/compiler.test.ts @@ -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"/); }); }); diff --git a/packages/loot-core/src/server/aql/compiler.ts b/packages/loot-core/src/server/aql/compiler.ts index cd4389c4e5..942a92b121 100644 --- a/packages/loot-core/src/server/aql/compiler.ts +++ b/packages/loot-core/src/server/aql/compiler.ts @@ -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;