Add account balance anchors
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user