Skip to content

A local-first personal finance app

Change lookback and look forward time range when fuzzy matching (#2300)

yoyotogblod37622162af0
diff --git a/packages/loot-core/src/server/accounts/sync.ts b/packages/loot-core/src/server/accounts/sync.ts
index c394f7f8c1..ccf2d09aba 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 reconcileExternalTransactions(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 reconcileExternalTransactions(acctId, transactions) {
`SELECT id, is_parent, date, imported_id, payee, category, notes, reconciled FROM v_transactions
WHERE date >= ? AND date <= ? AND amount = ? AND account = ?`,
[
- 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 = ?`,
[
- 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 0000000000..95017eaf16
--- /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