]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix duplication af account amounts on refresh
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 Mar 2019 20:05:50 +0000 (22:05 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 Mar 2019 20:54:57 +0000 (22:54 +0200)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java

index dfb1f74548a891e04a6c802c26b376be356aef0d..8f1a764b386aa4db91a901fcde5688ec346dd6d6 100644 (file)
@@ -170,9 +170,10 @@ public class RetrieveTransactionsTask
                                     L(String.format("found account: %s", acct_name));
 
                                     lastAccount = profile.tryLoadAccount(db, acct_name);
-                                    if (lastAccount == null) {
+                                    if (lastAccount == null)
                                         lastAccount = new LedgerAccount(acct_name);
-                                    }
+                                    else
+                                        lastAccount.removeAmounts();
                                     profile.storeAccount(db, lastAccount);
 
                                     // make sure the parent account(s) are present,
index 93c78de2a13e90b29336346bde0f8dcd610438bd..0751d10ac4aec966b6d289f4fccdcc78f43fa9b3 100644 (file)
@@ -160,4 +160,7 @@ public class LedgerAccount {
     public void toggleExpanded() {
         expanded = !expanded;
     }
+    public void removeAmounts() {
+        amounts.clear();
+    }
 }