From b0f55fae383f8e2ee3847229644791d70c62d88e Mon Sep 17 00:00:00 2001
From: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com>
Date: Thu, 9 May 2024 09:44:25 -0700
Subject: [PATCH] Fix preview transactions not detecting schedule as paid when
 a child transaction is linked. (#2712)

* Consider child transactions when querying preview transactions

* Release notes
---
 packages/loot-core/src/shared/schedules.ts | 4 ++--
 upcoming-release-notes/2712.md             | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 upcoming-release-notes/2712.md

diff --git a/packages/loot-core/src/shared/schedules.ts b/packages/loot-core/src/shared/schedules.ts
index 174b8102c..943a6e60d 100644
--- a/packages/loot-core/src/shared/schedules.ts
+++ b/packages/loot-core/src/shared/schedules.ts
@@ -36,14 +36,14 @@ export function getHasTransactionsQuery(schedules) {
           $gte:
             dateCond && dateCond.op === 'is'
               ? schedule.next_date
-              : monthUtils.subDays(schedule.next_date, 2),
+              : monthUtils.subDays(schedule.next_date, 7),
         },
       },
     };
   });
 
   return q('transactions')
-    .options({ splits: 'grouped' })
+    .options({ splits: 'all' })
     .filter({ $or: filters })
     .orderBy({ date: 'desc' })
     .select(['schedule', 'date']);
diff --git a/upcoming-release-notes/2712.md b/upcoming-release-notes/2712.md
new file mode 100644
index 000000000..45ede1502
--- /dev/null
+++ b/upcoming-release-notes/2712.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [joel-jeremy]
+---
+
+Fix preview transactions not detecting schedule as paid when a child transaction is linked.
-- 
GitLab