]> git.ktnx.net Git - mobile-ledger.git/commitdiff
better total management while parsing JSON transaction list
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 4 Apr 2019 06:52:51 +0000 (09:52 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 4 Apr 2019 06:52:51 +0000 (09:52 +0300)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java

index ea648c17d3b376fb12edae9d9cd938688210e70a..5d634d2f1ab1e8d0632eac6848a7ef627d135f27 100644 (file)
@@ -512,6 +512,7 @@ public class RetrieveTransactionsTask
                             Log.d("rtt", String.format(
                                     "Detected native file order after %d transactions (factor %d)",
                                     processedTransactionCount, orderAccumulator));
+                            progress.setTotal(Data.transactions.size());
                         }
                         else if (orderAccumulator < -30) {
                             transactionOrder = DetectedTransactionOrder.REVERSE_CHRONOLOGICAL;
@@ -542,8 +543,10 @@ public class RetrieveTransactionsTask
                         progress.setTotal(maxTransactionId);
                     }
 
-                    if ((progress.getTotal() == Progress.INDETERMINATE) ||
-                        (progress.getTotal() < transaction.getId()))
+
+                    if ((transactionOrder != DetectedTransactionOrder.UNKNOWN) &&
+                        ((progress.getTotal() == Progress.INDETERMINATE) ||
+                         (progress.getTotal() < transaction.getId())))
                         progress.setTotal(transaction.getId());
 
                     progress.setProgress(++processedTransactionCount);