Remove TASK_COUNT from TagData

pull/189/head
Alex Baker 10 years ago
parent 69dfe1fc32
commit 76a9eb1fce

@ -46,10 +46,6 @@ public final class TagData extends RemoteModel {
public static final LongProperty DELETION_DATE = new LongProperty(
TABLE, "deleted", Property.PROP_FLAG_DATE);
/** Task count */
public static final IntegerProperty TASK_COUNT = new IntegerProperty(
TABLE, "taskCount");
/** Tag ordering */
@Deprecated
public static final StringProperty TAG_ORDERING = new StringProperty(
@ -72,7 +68,6 @@ public final class TagData extends RemoteModel {
defaultValues.put(NAME.name, "");
defaultValues.put(DELETION_DATE.name, 0);
defaultValues.put(LAST_AUTOSYNC.name, 0);
defaultValues.put(TASK_COUNT.name, 0);
defaultValues.put(TAG_ORDERING.name, "[]");
}
@ -145,14 +140,6 @@ public final class TagData extends RemoteModel {
setValue(UUID, uuid);
}
public Integer getTaskCount() {
return getValue(TASK_COUNT);
}
public void setTaskCount(Integer taskCount) {
setValue(TASK_COUNT, taskCount);
}
public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}

@ -23,7 +23,6 @@ import com.todoroo.astrid.activity.FilterListFragment;
import com.todoroo.astrid.activity.TaskListActivity;
import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.core.SortHelper;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData;
@ -153,25 +152,8 @@ public class TagViewFragment extends TaskListFragment {
return tagData;
}
@Override
public void loadTaskListContent() {
super.loadTaskListContent();
if(taskAdapter == null || taskAdapter.getCursor() == null) {
return;
}
int count = taskAdapter.getCursor().getCount();
if(tagData != null && sortFlags <= SortHelper.FLAG_REVERSE_SORT &&
count != tagData.getTaskCount()) {
tagData.setTaskCount(count);
tagDataService.save(tagData);
}
}
// --------------------------------------------------------- refresh data
@Override
protected void initiateAutomaticSyncImpl() {
if (!isCurrentTaskListFragment()) {

@ -93,7 +93,6 @@ public class NameMaps {
putTagPropertyToServerName(TagData.NAME, "name", true);
putTagPropertyToServerName(TagData.DELETION_DATE, "deleted_at", true);
putTagPropertyToServerName(TagData.UUID, "uuid", false);
putTagPropertyToServerName(TagData.TASK_COUNT, "task_count", false);
}
// ----------

@ -26,7 +26,6 @@ import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.api.FilterWithUpdate;
import com.todoroo.astrid.dao.TaskDao.TaskCriteria;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.RemoteModel;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.tags.TagService.Tag;
@ -70,9 +69,6 @@ public class TagFilterExposer extends InjectingBroadcastReceiver implements Astr
FilterWithUpdate filter = new FilterWithUpdate(tag.tag,
title, tagTemplate,
contentValues);
if(!RemoteModel.NO_UUID.equals(tag.uuid)) {
filter.listingTitle += " (" + tag.count + ")";
}
filter.contextMenuLabels = new String[] {
context.getString(R.string.tag_cm_rename),

@ -81,12 +81,10 @@ public final class TagService {
*/
public static final class Tag {
public String tag;
public int count;
public String uuid;
public Tag(TagData tagData) {
tag = tagData.getName();
count = tagData.getTaskCount();
uuid = tagData.getUUID();
}

@ -211,7 +211,7 @@ public class WidgetHelper {
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 = tagDataService.fetchById(id, TagData.ID, TagData.NAME, 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());

Loading…
Cancel
Save