From 9f94a5dd80bf855f3ba71ab5b5114d73c5ba130d Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 30 Mar 2012 19:58:53 -0700 Subject: [PATCH] Force queries in date migrator to happen right away --- .../astrid/helper/DueDateTimeMigrator.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java b/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java index d9cda6371..2b2b25998 100644 --- a/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java +++ b/astrid/src/com/todoroo/astrid/helper/DueDateTimeMigrator.java @@ -41,9 +41,11 @@ public class DueDateTimeMigrator { Criterion.and(Task.DUE_DATE.gt(0), Functions.strftime(Task.DUE_DATE, STRFTIME_FORMAT).eq(LEGACY_NO_TIME_STRING)))); + tasksWithoutDueTime.getCount(); + tasksWithDueTime.getCount(); + try { // Set tasks without time to 12:00:00 - System.err.println("Processing tasks without due time"); processCursor(tasksWithoutDueTime, new TaskDateAdjuster() { @Override public void adjust(Date date) { @@ -58,7 +60,6 @@ public class DueDateTimeMigrator { } // Set tasks with time to have time HH:MM:01 - System.err.println("Processing tasks with due time"); processCursor(tasksWithDueTime, new TaskDateAdjuster() { @Override public void adjust(Date date) { @@ -77,13 +78,12 @@ public class DueDateTimeMigrator { private void processCursor(TodorooCursor cursor, TaskDateAdjuster adjuster) { Task curr = new Task(); for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { - curr.readFromCursor(cursor); - System.err.println("Processing task: " + curr.getValue(Task.TITLE)); - long time = curr.getValue(Task.DUE_DATE) / 1000L * 1000L; - Date date = new Date(time); - adjuster.adjust(date); - curr.setValue(Task.DUE_DATE, date.getTime()); - taskDao.save(curr); + curr.readFromCursor(cursor); + long time = curr.getValue(Task.DUE_DATE) / 1000L * 1000L; + Date date = new Date(time); + adjuster.adjust(date); + curr.setValue(Task.DUE_DATE, date.getTime()); + taskDao.save(curr); } }