Skip to content

Commit

Permalink
Fixed off-by-one-second task filtering error
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaGross committed Jan 15, 2011
1 parent 50203ec commit 1a8f646
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ How to debug/test on a USB device: (JoshuaGross Jan 14, 2011)

4. When running unit tests: make sure to *close all JUnit windows* before running tests. JUnit/Eclipse/Android work together in a very, very janky way. You may get incorrect results if you do not close the window out before running tests. You have been warned.

5. Make sure to commit changes both to the "astrid" project and the "astridApi" project while developing.

Contributors workflow
---------------

Expand Down
3 changes: 3 additions & 0 deletions astrid/src/com/todoroo/astrid/activity/TaskListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ protected void onCreate(Bundle savedInstanceState) {
if(database == null)
return;

// TODO: document debug code
//AndroidUtilities.copyDatabases(this, "/sdcard/dump"); // adb pull /sdcard/dump/database database

database.openForWriting();
setUpUiComponents();
onNewIntent(getIntent());
Expand Down
20 changes: 20 additions & 0 deletions astrid/src/com/todoroo/astrid/service/UpgradeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
import android.content.SharedPreferences.Editor;

import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DialogUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.core.SortHelper;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.utility.AstridPreferences;


Expand All @@ -34,6 +37,8 @@ public final class UpgradeService {
@Autowired
private Database database;

@Autowired private TaskService taskService;

public UpgradeService() {
DependencyInjectionService.getInstance().inject(this);
}
Expand Down Expand Up @@ -211,6 +216,21 @@ private void newVersionString(StringBuilder changeLog, String version, String[]

// --- upgrade functions

/**
* Fixes task filter missing tasks bug
*/
private void upgrade3To3_7(final Context context) {
TodorooCursor<Task> t = taskService.query(Query.select(Task.ID, Task.DUE_DATE).where(Task.DUE_DATE.gt(0)));
Task task = new Task();
for(t.moveToFirst(); !t.isAfterLast(); t.moveToNext()) {
task.readFromCursor(t);
if(task.hasDueDate()) {
task.setValue(Task.DUE_DATE, task.getValue(Task.DUE_DATE) / 1000L * 1000L);
taskService.save(task);
}
}
}

/**
* Moves sorting prefs to public pref store
* @param context
Expand Down

0 comments on commit 1a8f646

Please sign in to comment.