]> git.ktnx.net Git - mobile-ledger.git/commitdiff
central method for setting the last profile update date
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 7 Mar 2019 03:52:02 +0000 (05:52 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Thu, 7 Mar 2019 03:52:02 +0000 (05:52 +0200)
app/src/main/java/net/ktnx/mobileledger/async/RetrieveTransactionsTask.java
app/src/main/java/net/ktnx/mobileledger/model/MobileLedgerProfile.java

index 4ca3f827449c0c0ea5364229169b501877ea4a25..35277d6749e5f048c77f6ff62c78b1b0b1d465e3 100644 (file)
@@ -49,7 +49,6 @@ import java.net.URLDecoder;
 import java.nio.charset.StandardCharsets;
 import java.text.ParseException;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Stack;
 import java.util.regex.Matcher;
@@ -340,10 +339,7 @@ public class RetrieveTransactionsTask
                     profile.deleteNotPresentTransactions(db);
                     db.setTransactionSuccessful();
 
-                    Log.d("db", "Updating transaction value stamp");
-                    Date now = new Date();
-                    profile.setLongOption(MLDB.OPT_LAST_SCRAPE, now.getTime());
-                    Data.lastUpdateDate.set(now);
+                    profile.setLastUpdateStamp();
 
                     return null;
                 }
index 59ae1958dd89c5e23e4cc1342fc19a2a4b914727..ae877c3384c4ae992efa77f6b2d44b5b12285a2f 100644 (file)
@@ -25,6 +25,7 @@ import net.ktnx.mobileledger.utils.Globals;
 import net.ktnx.mobileledger.utils.MLDB;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.UUID;
 
@@ -340,4 +341,10 @@ public final class MobileLedgerProfile {
     public void deleteNotPresentTransactions(SQLiteDatabase db) {
         db.execSQL("DELETE FROM transactions WHERE profile=? AND keep = 0", new String[]{uuid});
     }
+    public void setLastUpdateStamp() {
+        Log.d("db", "Updating transaction value stamp");
+        Date now = new Date();
+        setLongOption(MLDB.OPT_LAST_SCRAPE, now.getTime());
+        Data.lastUpdateDate.set(now);
+    }
 }