]> git.ktnx.net Git - mobile-ledger.git/commitdiff
clear synthetic accounts list after propagating parsed amount
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 3 May 2019 17:20:15 +0000 (20:20 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 3 May 2019 17:20:15 +0000 (20:20 +0300)
this fixes a bug where a synthetic accounts tree gets the amounts of
the following real account

app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index 3ba73936deaa875068acbe6cbf2989255ef53556..f971cb02eb585232e0662481c549f03503379524 100644 (file)
@@ -251,12 +251,15 @@ public class RetrieveTransactionsTask
                                 profile.storeAccountValue(db, lastAccount.getName(), currency, val);
                                 lastAccount.addAmount(val, currency);
                                 for (LedgerAccount syn : syntheticAccounts.values()) {
+                                    L(String.format(Locale.ENGLISH, "propagating %s %1.2f to %s",
+                                            currency, val, syn.getName()));
                                     syn.addAmount(val, currency);
                                     profile.storeAccountValue(db, syn.getName(), currency, val);
                                 }
                             }
 
                             if (match_found) {
+                                syntheticAccounts.clear();
                                 state = ParserState.EXPECTING_ACCOUNT;
                                 L("→ expecting account");
                             }