wealthfolio-sync: skip the synthetic TOTAL row in ETL
Wealthfolio's daily_account_valuation includes a row with account_id='TOTAL' that pre-aggregates the per-account values for that day. Mirroring it into PG verbatim caused every SUM(total_value) in the Wealth dashboard to double-count (showing ~£2M against actual ~£1M). Drop the synthetic row at the dump step so the PG mirror only holds real-account rows. Initial sync after fix: 8,649 DAV rows (was 10,798), net worth resolves to £1,024,071 — matches the per-account latest snapshot.
This commit is contained in:
parent
f0ce7b0363
commit
498400173c
1 changed files with 2 additions and 1 deletions
|
|
@ -390,7 +390,8 @@ resource "kubernetes_deployment" "wealthfolio" {
|
|||
CAST(total_value AS REAL),
|
||||
CAST(cost_basis AS REAL),
|
||||
CAST(net_contribution AS REAL)
|
||||
FROM daily_account_valuation;
|
||||
FROM daily_account_valuation
|
||||
WHERE account_id != 'TOTAL'; -- synthetic pre-aggregated row; would double-count when summed
|
||||
SQ
|
||||
|
||||
sqlite3 -separator $'\t' /tmp/wf-sync/snapshot.db <<'SQ' > /tmp/wf-sync/activities.tsv
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue