Fixed the remaining gtasks task list updater tests that were broken

pull/14/head
Tim Su 14 years ago
parent 98d0c7ad97
commit 1a8b0154e6

@ -16,6 +16,7 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.sql.Order;
import com.todoroo.andlib.sql.QueryTemplate;
@ -25,9 +26,9 @@ import com.todoroo.astrid.api.FilterCategory;
import com.todoroo.astrid.api.FilterListHeader;
import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.MetadataApiDao.MetadataCriteria;
import com.todoroo.astrid.data.StoreObject;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.MetadataApiDao.MetadataCriteria;
import com.todoroo.astrid.data.TaskApiDao.TaskCriteria;
/**
@ -54,7 +55,8 @@ public class GtasksFilterExposer extends BroadcastReceiver {
MetadataCriteria.withKey(GtasksMetadata.METADATA_KEY),
TaskCriteria.isVisible(),
TaskCriteria.notDeleted(),
GtasksMetadata.LIST_ID.eq(list.getValue(GtasksList.REMOTE_ID)))).orderBy(Order.asc(GtasksMetadata.ORDER)),
GtasksMetadata.LIST_ID.eq(list.getValue(GtasksList.REMOTE_ID)))).orderBy(
Order.asc(Functions.cast(GtasksMetadata.ORDER, "INTEGER"))), //$NON-NLS-1$
values);
return filter;

@ -42,6 +42,7 @@ abstract public class GtasksIndentAction extends BroadcastReceiver {
String listId = metadata.getValue(GtasksMetadata.LIST_ID);
gtasksTaskListUpdater.indent(listId, taskId, getDelta());
gtasksTaskListUpdater.correctMetadataForList(listId);
Flags.set(Flags.REFRESH);
}

@ -39,6 +39,7 @@ abstract public class GtasksOrderAction extends BroadcastReceiver {
String listId = metadata.getValue(GtasksMetadata.LIST_ID);
gtasksTaskListUpdater.move(listId, taskId, getDelta());
gtasksTaskListUpdater.correctMetadataForList(listId);
Flags.set(Flags.REFRESH);
}

@ -45,7 +45,8 @@ public class GtasksTaskListUpdater {
iterateThroughList(list, new ListIterator() {
public void processTask(long taskId, Metadata metadata) {
System.err.format("%d: indent:%d, parent:%d\n", taskId, //$NON-NLS-1$
System.err.format("%d: %d, indent:%d, parent:%d\n", taskId, //$NON-NLS-1$
metadata.getValue(GtasksMetadata.ORDER),
metadata.getValue(GtasksMetadata.INDENT),
metadata.getValue(GtasksMetadata.PARENT_TASK));
}
@ -281,6 +282,8 @@ public class GtasksTaskListUpdater {
metadata.setValue(GtasksMetadata.INDENT, indent);
long parent = parents.get(taskId);
if(parent < 0)
parent = Task.NO_ID;
metadata.setValue(GtasksMetadata.PARENT_TASK, parent);
PluginServices.getMetadataService().save(metadata);

@ -85,7 +85,7 @@ public class GtasksTaskListUpdaterTest extends DatabaseTestCase {
Metadata metadata = gtasksMetadataService.getTaskMetadata(task.getId());
long parent = metadata.getValue(GtasksMetadata.PARENT_TASK);
if(expectedParent == null)
assertEquals("Task " + task.getValue(Task.TITLE) + " parent none", parent, 0);
assertEquals("Task " + task.getValue(Task.TITLE) + " parent none", 0, parent);
else
assertEquals("Task " + task.getValue(Task.TITLE) + " parent " +
expectedParent.getValue(Task.TITLE), expectedParent.getId(), parent);

Loading…
Cancel
Save