Private
Public Access
1
0

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 <noreply@anthropic.com>
This commit is contained in:
Catherine Renelle
2026-02-15 23:16:28 -05:00
parent e9ad7c0248
commit 24839a3a21
2 changed files with 106 additions and 85 deletions
@@ -29,6 +29,21 @@
<v-progress-linear v-if="loading" indeterminate color="primary" class="mb-4" />
<template v-if="performance && !loading">
<!-- No holdings: show account balance + prompt -->
<template v-if="performance.holdings.length === 0">
<v-card class="text-center pa-8">
<div class="text-h4 mb-2" :class="selectedAccountBalance >= 0 ? 'text-success' : 'text-error'">
{{ formatCurrency(selectedAccountBalance) }}
</div>
<div class="text-caption text-medium-emphasis mb-6">Account Balance</div>
<v-icon size="48" color="grey-lighten-1" class="mb-4">mdi-chart-pie</v-icon>
<p class="text-medium-emphasis">No individual holdings tracked for this account.</p>
<p class="text-medium-emphasis text-caption">Add holdings to see allocation, cost basis, and performance.</p>
</v-card>
</template>
<!-- Has holdings: show full portfolio view -->
<template v-else>
<!-- Portfolio Summary -->
<v-row class="mb-4">
<v-col cols="12" sm="6" md="3">
@@ -67,7 +82,7 @@
<!-- Allocation Chart + Holdings Table -->
<v-row>
<v-col v-if="performance.holdings.length > 0" cols="12" md="4">
<v-col cols="12" md="4">
<v-card>
<v-card-title>Allocation</v-card-title>
<v-card-text>
@@ -80,10 +95,10 @@
</v-card-text>
</v-card>
</v-col>
<v-col cols="12" :md="performance.holdings.length > 0 ? 8 : 12">
<v-col cols="12" md="8">
<v-card>
<v-card-title>Holdings</v-card-title>
<v-card-text v-if="performance.holdings.length > 0">
<v-card-text>
<v-data-table
:headers="holdingsHeaders"
:items="performance.holdings"
@@ -107,13 +122,11 @@
</template>
</v-data-table>
</v-card-text>
<v-card-text v-else class="text-center pa-8 text-medium-emphasis">
No holdings found for this account. Add investment holdings to track your portfolio.
</v-card-text>
</v-card>
</v-col>
</v-row>
</template>
</template>
<v-card v-if="!loading && !performance && selectedAccountId" class="text-center pa-8">
<v-icon size="48" color="grey-lighten-1" class="mb-4">mdi-chart-line</v-icon>
@@ -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) ?? []
+5 -2
View File
@@ -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