public class RetrieveTransactionsTask extends
AsyncTask<RetrieveTransactionsTask.Params, RetrieveTransactionsTask.Progress, Void> {
+ public static final int MATCHING_TRANSACTIONS_LIMIT = 50;
private static final Pattern transactionStartPattern = Pattern.compile("<tr class=\"title\" " +
"id=\"transaction-(\\d+)\"><td class=\"date\"[^\\\"]*>([\\d.-]+)</td>");
private static final Pattern transactionDescriptionPattern =
L("curr=" + currency + ", value=" + value);
db.execSQL(
"insert or replace into account_values(account, currency, value, keep) values(?, ?, ?, 1);",
- new Object[]{lastAccount.getName(),
- currency,
+ new Object[]{lastAccount.getName(), currency,
Float.valueOf(value)
});
lastAccount.addAmount(Float.parseFloat(value), currency);
"=?", 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()});
break;
default:
throw new RuntimeException(
- String.format("Unknown parser updating %s", state.name()));
+ String.format("Unknown parser updating %s",
+ state.name()));
}
}