From 4094526033b133e382b9836cba808910ed998bb0 Mon Sep 17 00:00:00 2001 From: yoyotogblo <31814048+yoyotogblo@users.noreply.github.com> Date: Mon, 29 Jan 2024 09:27:56 -0500 Subject: [PATCH] Change lookback and look forward time range when fuzzy matching Change to 7 days prior and after for imported transactions when fuzzy matching --- packages/loot-core/src/server/accounts/sync.ts | 12 ++++++------ upcoming-release-notes/2300.md | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 upcoming-release-notes/2300.md diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.ts index efd4b9cf391..a312083d128 100644 --- a/packages/loot-core/src/server/accounts/sync.ts +++ b/packages/loot-core/src/server/accounts/sync.ts @@ -468,7 +468,7 @@ export async function reconcileGoCardlessTransactions(acctId, transactions) { // If it didn't match, query data needed for fuzzy matching if (!match) { - // Look 1 day ahead and 4 days back when fuzzy matching. This + // Look 7 days ahead and 7 days back when fuzzy matching. This // needs to select all fields that need to be read from the // matched transaction. See the final pass below for the needed // fields. @@ -476,8 +476,8 @@ export async function reconcileGoCardlessTransactions(acctId, transactions) { `SELECT id, is_parent, date, imported_id, payee, category, notes, reconciled FROM v_transactions WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`, [ - db.toDateRepr(monthUtils.subDays(trans.date, 4)), - db.toDateRepr(monthUtils.addDays(trans.date, 1)), + db.toDateRepr(monthUtils.subDays(trans.date, 7)), + db.toDateRepr(monthUtils.addDays(trans.date, 7)), trans.amount || 0, acctId, ], @@ -631,7 +631,7 @@ export async function reconcileTransactions(acctId, transactions) { // If it didn't match, query data needed for fuzzy matching if (!match) { - // Look 1 day ahead and 4 days back when fuzzy matching. This + // Look 7 days ahead and 7 days back when fuzzy matching. This // needs to select all fields that need to be read from the // matched transaction. See the final pass below for the needed // fields. @@ -639,8 +639,8 @@ export async function reconcileTransactions(acctId, transactions) { `SELECT id, is_parent, date, imported_id, payee, category, notes, reconciled FROM v_transactions WHERE date >= ? AND date <= ? AND amount = ? AND account = ? AND is_child = 0`, [ - db.toDateRepr(monthUtils.subDays(trans.date, 4)), - db.toDateRepr(monthUtils.addDays(trans.date, 1)), + db.toDateRepr(monthUtils.subDays(trans.date, 7)), + db.toDateRepr(monthUtils.addDays(trans.date, 7)), trans.amount || 0, acctId, ], diff --git a/upcoming-release-notes/2300.md b/upcoming-release-notes/2300.md new file mode 100644 index 00000000000..95017eaf169 --- /dev/null +++ b/upcoming-release-notes/2300.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [yoyotogblo] +--- + +Change lookback and look forward time range when fuzzy matching