From 0b528c9f08403b2ab9a7e3909be1a976f7816b8d Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Wed, 4 Apr 2012 14:32:30 -0700 Subject: [PATCH] Fixed sync issues with the due time migrator --- .../com/todoroo/astrid/helper/DueDateTimeMigrator.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java b/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java index 2b2b25998..732ab9945 100644 --- a/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java +++ b/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java @@ -10,6 +10,7 @@ import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.dao.TaskDao; +import com.todoroo.astrid.data.SyncFlags; import com.todoroo.astrid.data.Task; public class DueDateTimeMigrator { @@ -31,13 +32,13 @@ public class DueDateTimeMigrator { public void migrateDueTimes() { if (!Preferences.getBoolean(PREF_MIGRATED_DUE_TIMES, false)) { // Get tasks with due time (i.e. due date != 23:59:59) - TodorooCursor tasksWithDueTime = taskDao.query(Query.select(Task.ID, Task.TITLE, Task.DUE_DATE).where( + TodorooCursor tasksWithDueTime = taskDao.query(Query.select(Task.ID, Task.DUE_DATE, Task.MODIFICATION_DATE).where( Criterion.and(Task.DUE_DATE.gt(0), Functions.strftime(Task.DUE_DATE, STRFTIME_FORMAT).neq(LEGACY_NO_TIME_STRING)))); try { // Get tasks with no due time (i.e. due date = 23:59:59) - TodorooCursor tasksWithoutDueTime = taskDao.query(Query.select(Task.ID, Task.TITLE, Task.DUE_DATE).where( + TodorooCursor tasksWithoutDueTime = taskDao.query(Query.select(Task.ID, Task.DUE_DATE, Task.MODIFICATION_DATE).where( Criterion.and(Task.DUE_DATE.gt(0), Functions.strftime(Task.DUE_DATE, STRFTIME_FORMAT).eq(LEGACY_NO_TIME_STRING)))); @@ -83,6 +84,9 @@ public class DueDateTimeMigrator { Date date = new Date(time); adjuster.adjust(date); curr.setValue(Task.DUE_DATE, date.getTime()); + curr.getSetValues().put(Task.MODIFICATION_DATE.name, curr.getValue(Task.MODIFICATION_DATE)); // Don't change modification date + curr.putTransitory(SyncFlags.ACTFM_SUPPRESS_SYNC, true); + curr.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true); taskDao.save(curr); } }