Added a bitwise and sql function, updated the check for emergent tags accordingly

pull/14/head
Sam Bosley 13 years ago
parent eb97c51fd1
commit aead7c1039

@ -1,5 +1,6 @@
package com.todoroo.andlib.sql; package com.todoroo.andlib.sql;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.StringProperty; import com.todoroo.andlib.data.Property.StringProperty;
@ -50,4 +51,8 @@ public final class Functions {
return new Field("LENGTH(" + field.toString() + ")"); return new Field("LENGTH(" + field.toString() + ")");
} }
public static Field bitwiseAnd(IntegerProperty field, int value) {
return new Field(field.toString() + " & " + value);
}
} }

@ -770,7 +770,8 @@ public class TaskListActivity extends ListActivity implements OnScrollListener,
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
String nameLike = "%" + assignedEmail + "%"; String nameLike = "%" + assignedEmail + "%";
TodorooCursor<TagData> c = tagDataService.query(Query.select(TagData.NAME, TagData.TASK_COUNT, TagData.REMOTE_ID).where(Criterion.and(TagData.FLAGS.gte(TagData.FLAG_EMERGENT), TagData.MEMBERS.like(nameLike)))); TodorooCursor<TagData> c = tagDataService.query(Query.select(TagData.NAME, TagData.TASK_COUNT, TagData.REMOTE_ID).where(Criterion.and(
Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_EMERGENT).gt(0), TagData.MEMBERS.like(nameLike))));
try { try {
if (c.getCount() > 0) { if (c.getCount() > 0) {
c.moveToFirst(); c.moveToFirst();

Loading…
Cancel
Save