Fixed a stupid bug when checking tag membership

pull/14/head
Sam Bosley 12 years ago
parent e2dac89c37
commit 918e533ead

@ -694,7 +694,7 @@ public class TaskListActivity extends AstridActivity implements MainMenuListener
boolean memberFound = false; boolean memberFound = false;
if (TextUtils.isEmpty(members)) if (TextUtils.isEmpty(members))
memberFound = td.getValue(TagData.USER_ID).equals(assignedId) || tagMetadataDao.memberOfTagData(assignedEmail, assignedId); memberFound = td.getValue(TagData.USER_ID).equals(assignedId) || tagMetadataDao.memberOfTagData(assignedEmail, td.getUuid(), assignedId);
else { else {
JSONObject user = new JSONObject(); JSONObject user = new JSONObject();
JSONArray membersArray = null; JSONArray membersArray = null;

@ -189,19 +189,19 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
} }
} }
public boolean memberOfTagData(String email, String id) { public boolean memberOfTagData(String email, String tagId, String memberId) {
Criterion criterion; Criterion criterion;
if (!RemoteModel.isUuidEmpty(id) && !TextUtils.isEmpty(email)) if (!RemoteModel.isUuidEmpty(memberId) && !TextUtils.isEmpty(email))
criterion = Criterion.or(TagMemberMetadata.USER_UUID.eq(email), TagMemberMetadata.USER_UUID.eq(id)); criterion = Criterion.or(TagMemberMetadata.USER_UUID.eq(email), TagMemberMetadata.USER_UUID.eq(memberId));
else if (!RemoteModel.isUuidEmpty(id)) else if (!RemoteModel.isUuidEmpty(memberId))
criterion = TagMemberMetadata.USER_UUID.eq(id); criterion = TagMemberMetadata.USER_UUID.eq(memberId);
else if (!TextUtils.isEmpty(email)) else if (!TextUtils.isEmpty(email))
criterion = TagMemberMetadata.USER_UUID.eq(email); criterion = TagMemberMetadata.USER_UUID.eq(email);
else else
return false; return false;
TodorooCursor<TagMetadata> count = query(Query.select(TagMetadata.ID).where( TodorooCursor<TagMetadata> count = query(Query.select(TagMetadata.ID).where(
Criterion.and(TagMetadataCriteria.withKey(TagMemberMetadata.KEY), criterion))); Criterion.and(TagMetadataCriteria.withKey(TagMemberMetadata.KEY), TagMetadata.TAG_UUID.eq(tagId), criterion)));
try { try {
return count.getCount() > 0; return count.getCount() > 0;
} finally { } finally {

Loading…
Cancel
Save