Skip to content

Commit

Permalink
Remove unused TagData columns
Browse files Browse the repository at this point in the history
  • Loading branch information
abaker committed Jul 6, 2014
1 parent ac24473 commit fd37a16
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 104 deletions.
93 changes: 1 addition & 92 deletions api/src/main/java/com/todoroo/astrid/data/TagData.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,74 +42,14 @@ public final class TagData extends RemoteModel {
public static final StringProperty NAME = new StringProperty(
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 */
public static final LongProperty DELETION_DATE = new LongProperty(
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 */
public static final IntegerProperty TASK_COUNT = new IntegerProperty(
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 */
@Deprecated
public static final StringProperty TAG_ORDERING = new StringProperty(
Expand All @@ -130,25 +70,10 @@ public final class TagData extends RemoteModel {
static {
defaultValues.put(UUID.name, NO_UUID);
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(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(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(IS_FOLDER.name, 0);
}

@Override
Expand Down Expand Up @@ -189,11 +114,7 @@ public String getUuid() {
/** Checks whether task is deleted. Will return false if DELETION_DATE not read */
public boolean isDeleted() {
// assume false if we didn't load deletion date
if(!containsValue(DELETION_DATE)) {
return false;
} else {
return getValue(DELETION_DATE) > 0;
}
return containsValue(DELETION_DATE) && getValue(DELETION_DATE) > 0;
}

public String getName() {
Expand Down Expand Up @@ -232,19 +153,7 @@ public void setTaskCount(Integer taskCount) {
setValue(TASK_COUNT, taskCount);
}

public String getMembers() {
return getValue(MEMBERS);
}

public void setMembers(String members) {
setValue(MEMBERS, members);
}

public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}

public void setMemberCount(Integer memberCount) {
setValue(MEMBER_COUNT, memberCount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.todoroo.astrid.tags.TagFilterExposer;
import com.todoroo.astrid.tags.TagService;

import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tasks.R;
Expand Down Expand Up @@ -172,10 +171,6 @@ private void saveSettings() {
}
}

JSONArray members = new JSONArray();

tagData.setMemberCount(members.length());

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(tagName.getWindowToken(), 0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ private static void putTagPropertyToServerName(Property<?> property, String serv
TAG_PROPERTIES_EXCLUDED = new HashSet<>();

putTagPropertyToServerName(TagData.NAME, "name", true);
putTagPropertyToServerName(TagData.CREATION_DATE, "created_at", true);
putTagPropertyToServerName(TagData.DELETION_DATE, "deleted_at", true);
putTagPropertyToServerName(TagData.UUID, "uuid", false);
putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false);
putTagPropertyToServerName(TagData.TAG_DESCRIPTION, "description", true);
putTagPropertyToServerName(TagData.IS_FOLDER, "is_folder", false);
}

// ----------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected void showDialog() {
@Override
protected Intent ok() {
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);
if (tagData != null) {
tagData.setDeletionDate(DateUtilities.now());
Expand Down
5 changes: 3 additions & 2 deletions astrid/src/main/java/com/todoroo/astrid/tags/TagService.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ public String getTagsAsString(long taskId, String separator) {
*/
public ArrayList<Tag> getTagList() {
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(),
TagData.IS_FOLDER.neq(1)), TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME))));
TodorooCursor<TagData> cursor = tagDataService.query(Query.select(TagData.PROPERTIES).where(Criterion.and(
TagData.DELETION_DATE.eq(0),
TagData.NAME.isNotNull())).orderBy(Order.asc(Functions.upper(TagData.NAME))));
try {
TagData tagData = new TagData();
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
Expand Down
2 changes: 1 addition & 1 deletion astrid/src/main/java/org/tasks/widget/WidgetHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public Filter getFilter(Context context, int widgetId) {
long id = preferences.getLong(WidgetConfigActivity.PREF_TAG_ID + widgetId, 0);
TagData tagData;
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
filter = TagFilterExposer.filterFromTagData(context, tagData);
preferences.setString(WidgetConfigActivity.PREF_SQL + widgetId, filter.getSqlQuery());
Expand Down

0 comments on commit fd37a16

Please sign in to comment.