Remove unused TagData columns

pull/189/head
Alex Baker 12 years ago
parent ac24473b2e
commit fd37a16118

@ -42,74 +42,14 @@ public final class TagData extends RemoteModel {
public static final StringProperty NAME = new StringProperty( public static final StringProperty NAME = new StringProperty(
TABLE, "name"); TABLE, "name");
/** Tag team array (JSON) */
@Deprecated public static final StringProperty MEMBERS = new StringProperty(
TABLE, "members");
/** Tag member count */
public static final IntegerProperty MEMBER_COUNT = new IntegerProperty(
TABLE, "memberCount");
/** Flags */
public static final IntegerProperty FLAGS = new IntegerProperty(
TABLE, "flags");
/** Unixtime Project was created */
public static final LongProperty CREATION_DATE = new LongProperty(
TABLE, "created", Property.PROP_FLAG_DATE);
/** Unixtime Project was completed. 0 means active */
public static final LongProperty COMPLETION_DATE = new LongProperty(
TABLE, "completed", Property.PROP_FLAG_DATE);
/** Unixtime Project was deleted. 0 means not deleted */ /** Unixtime Project was deleted. 0 means not deleted */
public static final LongProperty DELETION_DATE = new LongProperty( public static final LongProperty DELETION_DATE = new LongProperty(
TABLE, "deleted", Property.PROP_FLAG_DATE); TABLE, "deleted", Property.PROP_FLAG_DATE);
/** Project picture thumbnail */
public static final StringProperty THUMB = new StringProperty(
TABLE, "thumb");
/** Project last activity date */
public static final LongProperty LAST_ACTIVITY_DATE = new LongProperty(
TABLE, "lastActivityDate", Property.PROP_FLAG_DATE);
/** Whether user is part of Tag team */
public static final IntegerProperty IS_TEAM = new IntegerProperty(
TABLE, "isTeam");
/** Whether Tag has unread activity */
public static final IntegerProperty IS_UNREAD = new IntegerProperty(
TABLE, "isUnread");
/** Whether tag is a folder */
public static final IntegerProperty IS_FOLDER = new IntegerProperty(
TABLE, "isFolder", Property.PROP_FLAG_BOOLEAN);
/** Task count */ /** Task count */
public static final IntegerProperty TASK_COUNT = new IntegerProperty( public static final IntegerProperty TASK_COUNT = new IntegerProperty(
TABLE, "taskCount"); TABLE, "taskCount");
/** Tag Desription */
public static final StringProperty TAG_DESCRIPTION = new StringProperty(
TABLE, "tagDescription");
/** Pushed at date */
public static final LongProperty PUSHED_AT = new LongProperty(
TABLE, PUSHED_AT_PROPERTY_NAME, Property.PROP_FLAG_DATE);
/** Tasks pushed at date */
public static final LongProperty TASKS_PUSHED_AT = new LongProperty(
TABLE, "tasks_pushed_at", Property.PROP_FLAG_DATE);
/** Metadata pushed at date */
public static final LongProperty METADATA_PUSHED_AT = new LongProperty(
TABLE, "metadata_pushed_at", Property.PROP_FLAG_DATE);
/** User activities pushed at date */
public static final LongProperty USER_ACTIVITIES_PUSHED_AT = new LongProperty(
TABLE, "activities_pushed_at", Property.PROP_FLAG_DATE);
/** Tag ordering */ /** Tag ordering */
@Deprecated @Deprecated
public static final StringProperty TAG_ORDERING = new StringProperty( public static final StringProperty TAG_ORDERING = new StringProperty(
@ -130,25 +70,10 @@ public final class TagData extends RemoteModel {
static { static {
defaultValues.put(UUID.name, NO_UUID); defaultValues.put(UUID.name, NO_UUID);
defaultValues.put(NAME.name, ""); defaultValues.put(NAME.name, "");
defaultValues.put(IS_TEAM.name, 1);
defaultValues.put(MEMBERS.name, "");
defaultValues.put(MEMBER_COUNT.name, 0);
defaultValues.put(FLAGS.name, 0);
defaultValues.put(COMPLETION_DATE.name, 0);
defaultValues.put(DELETION_DATE.name, 0); defaultValues.put(DELETION_DATE.name, 0);
defaultValues.put(LAST_AUTOSYNC.name, 0); defaultValues.put(LAST_AUTOSYNC.name, 0);
defaultValues.put(THUMB.name, "");
defaultValues.put(LAST_ACTIVITY_DATE.name, 0);
defaultValues.put(IS_UNREAD.name, 0);
defaultValues.put(TASK_COUNT.name, 0); defaultValues.put(TASK_COUNT.name, 0);
defaultValues.put(TAG_DESCRIPTION.name, "");
defaultValues.put(PUSHED_AT.name, 0L);
defaultValues.put(TASKS_PUSHED_AT.name, 0L);
defaultValues.put(METADATA_PUSHED_AT.name, 0L);
defaultValues.put(USER_ACTIVITIES_PUSHED_AT.name, 0L);
defaultValues.put(TAG_ORDERING.name, "[]"); defaultValues.put(TAG_ORDERING.name, "[]");
defaultValues.put(IS_FOLDER.name, 0);
} }
@Override @Override
@ -189,11 +114,7 @@ public final class TagData extends RemoteModel {
/** Checks whether task is deleted. Will return false if DELETION_DATE not read */ /** Checks whether task is deleted. Will return false if DELETION_DATE not read */
public boolean isDeleted() { public boolean isDeleted() {
// assume false if we didn't load deletion date // assume false if we didn't load deletion date
if(!containsValue(DELETION_DATE)) { return containsValue(DELETION_DATE) && getValue(DELETION_DATE) > 0;
return false;
} else {
return getValue(DELETION_DATE) > 0;
}
} }
public String getName() { public String getName() {
@ -232,19 +153,7 @@ public final class TagData extends RemoteModel {
setValue(TASK_COUNT, taskCount); setValue(TASK_COUNT, taskCount);
} }
public String getMembers() {
return getValue(MEMBERS);
}
public void setMembers(String members) {
setValue(MEMBERS, members);
}
public void setDeletionDate(Long deletionDate) { public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate); setValue(DELETION_DATE, deletionDate);
} }
public void setMemberCount(Integer memberCount) {
setValue(MEMBER_COUNT, memberCount);
}
} }

@ -30,7 +30,6 @@ import com.todoroo.astrid.service.TagDataService;
import com.todoroo.astrid.tags.TagFilterExposer; import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.tags.TagService; import com.todoroo.astrid.tags.TagService;
import org.json.JSONArray;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.tasks.R; import org.tasks.R;
@ -172,10 +171,6 @@ public class TagSettingsActivity extends InjectingActionBarActivity {
} }
} }
JSONArray members = new JSONArray();
tagData.setMemberCount(members.length());
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(tagName.getWindowToken(), 0); imm.hideSoftInputFromWindow(tagName.getWindowToken(), 0);

@ -92,12 +92,9 @@ public class NameMaps {
TAG_PROPERTIES_EXCLUDED = new HashSet<>(); TAG_PROPERTIES_EXCLUDED = new HashSet<>();
putTagPropertyToServerName(TagData.NAME, "name", true); putTagPropertyToServerName(TagData.NAME, "name", true);
putTagPropertyToServerName(TagData.CREATION_DATE, "created_at", true);
putTagPropertyToServerName(TagData.DELETION_DATE, "deleted_at", true); putTagPropertyToServerName(TagData.DELETION_DATE, "deleted_at", true);
putTagPropertyToServerName(TagData.UUID, "uuid", false); putTagPropertyToServerName(TagData.UUID, "uuid", false);
putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false); putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false);
putTagPropertyToServerName(TagData.TAG_DESCRIPTION, "description", true);
putTagPropertyToServerName(TagData.IS_FOLDER, "is_folder", false);
} }
// ---------- // ----------

@ -32,7 +32,7 @@ public class DeleteTagActivity extends TagActivity {
@Override @Override
protected Intent ok() { protected Intent ok() {
int deleted = deleteTagMetadata(uuid); int deleted = deleteTagMetadata(uuid);
TagData tagData = tagDataDao.fetch(uuid, TagData.ID, TagData.UUID, TagData.DELETION_DATE, TagData.MEMBER_COUNT); TagData tagData = tagDataDao.fetch(uuid, TagData.ID, TagData.UUID, TagData.DELETION_DATE);
Intent tagDeleted = new Intent(AstridApiConstants.BROADCAST_EVENT_TAG_DELETED); Intent tagDeleted = new Intent(AstridApiConstants.BROADCAST_EVENT_TAG_DELETED);
if (tagData != null) { if (tagData != null) {
tagData.setDeletionDate(DateUtilities.now()); tagData.setDeletionDate(DateUtilities.now());

@ -262,8 +262,9 @@ public final class TagService {
*/ */
public ArrayList<Tag> getTagList() { public ArrayList<Tag> getTagList() {
ArrayList<Tag> tagList = new ArrayList<>(); ArrayList<Tag> tagList = new ArrayList<>();
TodorooCursor<TagData> cursor = tagDataService.query(Query.select(TagData.PROPERTIES).where(Criterion.and(TagData.DELETION_DATE.eq(0), Criterion.or(TagData.IS_FOLDER.isNull(), TodorooCursor<TagData> cursor = tagDataService.query(Query.select(TagData.PROPERTIES).where(Criterion.and(
TagData.IS_FOLDER.neq(1)), TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME)))); TagData.DELETION_DATE.eq(0),
TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME))));
try { try {
TagData tagData = new TagData(); TagData tagData = new TagData();
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {

@ -211,7 +211,7 @@ public class WidgetHelper {
long id = preferences.getLong(WidgetConfigActivity.PREF_TAG_ID + widgetId, 0); long id = preferences.getLong(WidgetConfigActivity.PREF_TAG_ID + widgetId, 0);
TagData tagData; TagData tagData;
if (id > 0) { if (id > 0) {
tagData = tagDataService.fetchById(id, TagData.ID, TagData.NAME, TagData.TASK_COUNT, TagData.UUID, TagData.MEMBER_COUNT); tagData = tagDataService.fetchById(id, TagData.ID, TagData.NAME, TagData.TASK_COUNT, TagData.UUID);
if (tagData != null && !tagData.getName().equals(filter.title)) { // Tag has been renamed; rebuild filter if (tagData != null && !tagData.getName().equals(filter.title)) { // Tag has been renamed; rebuild filter
filter = TagFilterExposer.filterFromTagData(context, tagData); filter = TagFilterExposer.filterFromTagData(context, tagData);
preferences.setString(WidgetConfigActivity.PREF_SQL + widgetId, filter.getSqlQuery()); preferences.setString(WidgetConfigActivity.PREF_SQL + widgetId, filter.getSqlQuery());

Loading…
Cancel
Save