]> git.ktnx.net Git - mobile-ledger.git/commitdiff
fix wrong showing of sub-accounts of collapsed accounts upon refresh
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 14 Mar 2019 20:43:04 +0000 (22:43 +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

index 8f1a764b386aa4db91a901fcde5688ec346dd6d6..c4f55d0e7e6114caf66151ca71f276981eb31d16 100644 (file)
@@ -172,8 +172,7 @@ public class RetrieveTransactionsTask
                                     lastAccount = profile.tryLoadAccount(db, acct_name);
                                     if (lastAccount == null)
                                         lastAccount = new LedgerAccount(acct_name);
-                                    else
-                                        lastAccount.removeAmounts();
+                                    else lastAccount.removeAmounts();
                                     profile.storeAccount(db, lastAccount);
 
                                     // make sure the parent account(s) are present,
@@ -191,15 +190,16 @@ public class RetrieveTransactionsTask
                                             String aName = toAppend.pop();
                                             LedgerAccount acc = new LedgerAccount(aName);
                                             acc.setHiddenByStar(lastAccount.isHiddenByStar());
-                                            if (!onlyStarred || !acc.isHiddenByStar())
-                                                accountList.add(acc);
+                                            if ((!onlyStarred || !acc.isHiddenByStar()) &&
+                                                acc.isVisible(accountList)) accountList.add(acc);
                                             L(String.format("gap-filling with %s", aName));
                                             accountNames.put(aName, null);
                                             profile.storeAccount(db, acc);
                                         }
                                     }
 
-                                    if (!onlyStarred || !lastAccount.isHiddenByStar())
+                                    if ((!onlyStarred || !lastAccount.isHiddenByStar()) &&
+                                        lastAccount.isVisible(accountList))
                                         accountList.add(lastAccount);
                                     accountNames.put(acct_name, null);