In subtasks mode, new tasks should be added at the top of the list like on the web

pull/14/head
Sam Bosley 12 years ago
parent 7a655f04bb
commit 6dded6fb06

@ -83,7 +83,9 @@ public abstract class AstridOrderedListUpdater<LIST> {
currentIds.add(id); currentIds.add(id);
} }
Set<String> idsInQuery = new HashSet<String>(); Set<String> idsInQuery = new HashSet<String>();
TodorooCursor<Task> tasks = taskService.fetchFiltered(filter.getSqlQuery(), null, Task.UUID); String sql = filter.getSqlQuery().replaceAll("ORDER BY .*", ""); //$NON-NLS-1$//$NON-NLS-2$
sql = sql + String.format(" ORDER BY %s", Task.CREATION_DATE); //$NON-NLS-1$
TodorooCursor<Task> tasks = taskService.fetchFiltered(sql, null, Task.UUID);
try { try {
for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) { for (tasks.moveToFirst(); !tasks.isAfterLast(); tasks.moveToNext()) {
String id = tasks.getString(0); String id = tasks.getString(0);
@ -93,7 +95,7 @@ public abstract class AstridOrderedListUpdater<LIST> {
changedThings = true; changedThings = true;
Node newNode = new Node(id, treeRoot, 0); Node newNode = new Node(id, treeRoot, 0);
treeRoot.children.add(newNode); treeRoot.children.add(0, newNode);
idToNode.put(id, newNode); idToNode.put(id, newNode);
} }
@ -331,7 +333,7 @@ public abstract class AstridOrderedListUpdater<LIST> {
return; return;
Node newNode = new Node(uuid, treeRoot, 0); Node newNode = new Node(uuid, treeRoot, 0);
treeRoot.children.add(newNode); treeRoot.children.add(0, newNode);
idToNode.put(uuid, newNode); idToNode.put(uuid, newNode);
writeSerialization(list, serializeTree(), true); writeSerialization(list, serializeTree(), true);
applyToFilter(filter); applyToFilter(filter);

Loading…
Cancel
Save