When deleting tasks after a manual sync (i.e. ones that weren't returned) only delete things assigned to me

pull/14/head
Sam Bosley 13 years ago
parent e2b51f072a
commit 8a377ffd33

@ -1048,7 +1048,7 @@ public final class ActFmSyncService {
} }
protected void deleteExtras(Long[] localIds) { protected void deleteExtras(Long[] localIds) {
taskService.deleteWhere(Criterion.and(TaskCriteria.activeAndVisible(), taskService.deleteWhere(Criterion.and(TaskCriteria.activeVisibleMine(),
Task.REMOTE_ID.isNotNull(), Task.REMOTE_ID.isNotNull(),
Criterion.not(Task.ID.in(localIds)))); Criterion.not(Task.ID.in(localIds))));
} }

@ -15,6 +15,7 @@ import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService; import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Field;
import com.todoroo.andlib.sql.Functions; import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.Query; import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.DateUtilities; import com.todoroo.andlib.utility.DateUtilities;
@ -78,6 +79,16 @@ public class TaskDao extends DatabaseDao<Task> {
Task.HIDE_UNTIL.lt(Functions.now())); Task.HIDE_UNTIL.lt(Functions.now()));
} }
/** @return tasks that have not yet been completed or deleted and are assigned to me */
public static Criterion activeVisibleMine() {
return Criterion.and(Task.COMPLETION_DATE.eq(0),
Task.DELETION_DATE.eq(0),
Task.HIDE_UNTIL.lt(Functions.now()),
Field.field(Task.FLAGS.name + " & " + //$NON-NLS-1$
Task.FLAG_IS_READONLY).eq(0),
Task.USER_ID.eq(0));
}
/** @return tasks that have not yet been completed or deleted */ /** @return tasks that have not yet been completed or deleted */
public static Criterion isActive() { public static Criterion isActive() {
return Criterion.and(Task.COMPLETION_DATE.eq(0), return Criterion.and(Task.COMPLETION_DATE.eq(0),

Loading…
Cancel
Save