]> git.ktnx.net Git - mobile-ledger.git/commitdiff
commit right after the account list is complete
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 24 Mar 2019 09:39:58 +0000 (11:39 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Mon, 25 Mar 2019 06:17:36 +0000 (06:17 +0000)
the transaction list can be updated in its own transaction

shorter transactions - happier database

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

index dc73944332b728ccae78e798089fa71c11d9a35c..69b43fa6169cccd12826d483496959d79cf7bf24 100644 (file)
@@ -159,7 +159,13 @@ public class RetrieveTransactionsTask
                                 if (line.equals("<h2>General Journal</h2>")) {
                                     state = ParserState.EXPECTING_TRANSACTION;
                                     L("→ expecting transaction");
+                                    // commit the current transaction and start a new one
+                                    // the account list in the UI should reflect the (committed)
+                                    // state of the database
+                                    db.setTransactionSuccessful();
+                                    db.endTransaction();
                                     Data.accounts.set(accountList);
+                                    db.beginTransaction();
                                     continue;
                                 }
                                 m = reAccountName.matcher(line);