From 24839a3a21cd3ab446618bc29d304a4737fe7042 Mon Sep 17 00:00:00 2001 From: Catherine Renelle <32781029+catrenelle@users.noreply.github.com> Date: Sun, 15 Feb 2026 23:16:28 -0500 Subject: [PATCH] Add 7-day sync overlap buffer and improve empty investments state SimpleFIN sync now looks back 7 days from last sync to catch retroactively posted transactions. Investments page shows account balance instead of $0 summary cards when no holdings exist. Co-Authored-By: Claude Opus 4.6 --- .../src/views/investments/InvestmentsView.vue | 184 ++++++++++-------- src/Purrse.Api/Services/BankSyncService.cs | 7 +- 2 files changed, 106 insertions(+), 85 deletions(-) diff --git a/frontend/src/views/investments/InvestmentsView.vue b/frontend/src/views/investments/InvestmentsView.vue index c9fb05a..e0bb257 100644 --- a/frontend/src/views/investments/InvestmentsView.vue +++ b/frontend/src/views/investments/InvestmentsView.vue @@ -29,90 +29,103 @@ @@ -158,6 +171,11 @@ const investmentAccounts = computed(() => })) ) +const selectedAccountBalance = computed(() => { + const acct = investmentAccounts.value.find(a => a.id === selectedAccountId.value) + return acct?.balance ?? 0 +}) + // --- Allocation Chart --- const allocationChartSeries = computed(() => performance.value?.holdings.map(h => h.marketValue) ?? [] diff --git a/src/Purrse.Api/Services/BankSyncService.cs b/src/Purrse.Api/Services/BankSyncService.cs index a32455f..f212454 100644 --- a/src/Purrse.Api/Services/BankSyncService.cs +++ b/src/Purrse.Api/Services/BankSyncService.cs @@ -424,12 +424,15 @@ public class BankSyncService : IBankSyncService // For SimpleFIN, use the earliest start date across all accounts so the // single API call (cached) returns transactions covering every account. + // Subtract a 7-day overlap buffer because banks may post transactions with + // dates earlier than when they appear in the SimpleFIN feed. Duplicate + // detection (FitId + fingerprint) ensures re-fetched transactions are skipped. var endDate = DateTime.UtcNow; DateTime? simpleFinStartDate = null; if (connection.Provider == SyncProvider.SimpleFIN) { simpleFinStartDate = enabledAccounts - .Select(la => la.LastSyncAt ?? endDate.AddDays(-90)) + .Select(la => la.LastSyncAt?.AddDays(-7) ?? endDate.AddDays(-90)) .Min(); } @@ -447,7 +450,7 @@ public class BankSyncService : IBankSyncService try { - var startDate = simpleFinStartDate ?? linkedAccount.LastSyncAt ?? endDate.AddDays(-90); + var startDate = simpleFinStartDate ?? linkedAccount.LastSyncAt?.AddDays(-7) ?? endDate.AddDays(-90); var provider = connection.Provider == SyncProvider.Plaid ? (Purrse.Plugins.Abstractions.IAccountSyncProvider)_plaid