Add account balance anchors

This commit is contained in:
Lars Nolden
2026-09-14 13:32:18 +02:00
parent 83bb86bc93
commit 71e95917da
15 changed files with 440 additions and 23 deletions
+6
View File
@@ -61,6 +61,12 @@ func SaveAccount(d *domain.Dataset, v domain.Account) error {
}
for i, x := range d.Accounts {
if x.ID == v.ID {
// A balance belongs to the account identity and currency that the
// bank reported. Changing either makes the captured figure stale;
// clear it so the next connected sync can capture a matching one.
if x.Currency != v.Currency || x.ExternalAccountID != v.ExternalAccountID {
v.AnchorBalance, v.AnchorDate = "", ""
}
d.Accounts[i] = v
return nil
}