From 985b25d6284011d906db1399790832008c50b07d Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 5 Jan 2019 12:13:11 +0000 Subject: [PATCH] extract the matching transactions limit constant --- .../ktnx/mobileledger/async/RetrieveTransactionsTask.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java index 601e7eca..634bb61b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java +++ b/app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java @@ -51,6 +51,7 @@ import java.util.regex.Pattern; public class RetrieveTransactionsTask extends AsyncTask { + public static final int MATCHING_TRANSACTIONS_LIMIT = 100; private static final Pattern transactionStartPattern = Pattern.compile("([\\d.-]+)"); private static final Pattern transactionDescriptionPattern = @@ -246,7 +247,9 @@ public class RetrieveTransactionsTask extends "=?", new Integer[]{transaction.getId()}); matchedTransactionsCount++; - if (matchedTransactionsCount == 100) { + if (matchedTransactionsCount == + MATCHING_TRANSACTIONS_LIMIT) + { db.execSQL("UPDATE transactions SET keep=1 WHERE " + "id < ?", new Integer[]{transaction.getId()}); -- 2.39.5