Don't always save task modification date when you drag and drop

pull/14/head
Tim Su 13 years ago
parent 6849e1fafb
commit 2dd5482bdf

@ -9,7 +9,6 @@ import java.util.concurrent.atomic.AtomicReference;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.Metadata;
@ -113,7 +112,7 @@ abstract public class OrderedListUpdater<LIST> {
else
metadata.setValue(parentProperty(), newParent);
}
saveAndUpdateModifiedDate(metadata, taskId);
saveAndUpdateModifiedDate(metadata);
}
} else if(targetTaskIndent.get() > -1) {
// found first task that is not beneath target
@ -121,7 +120,7 @@ abstract public class OrderedListUpdater<LIST> {
targetTaskIndent.set(-1);
else {
metadata.setValue(indentProperty(), indent + delta);
saveAndUpdateModifiedDate(metadata, taskId);
saveAndUpdateModifiedDate(metadata);
}
} else {
previousIndent.set(indent);
@ -129,7 +128,7 @@ abstract public class OrderedListUpdater<LIST> {
}
if(!metadata.isSaved())
saveAndUpdateModifiedDate(metadata, taskId);
saveAndUpdateModifiedDate(metadata);
}
});
@ -241,7 +240,7 @@ abstract public class OrderedListUpdater<LIST> {
parentChanged = true;
metadata.setValue(parentProperty(), node.parent.taskId);
}
saveAndUpdateModifiedDate(metadata, node.taskId);
saveAndUpdateModifiedDate(metadata);
if(parentChanged)
onMovedOrIndented(metadata);
}
@ -300,17 +299,10 @@ abstract public class OrderedListUpdater<LIST> {
return root;
}
protected final Task taskContainer = new Task();
protected void saveAndUpdateModifiedDate(Metadata metadata, long taskId) {
protected void saveAndUpdateModifiedDate(Metadata metadata) {
if(metadata.getSetValues().size() == 0)
return;
PluginServices.getMetadataService().save(metadata);
taskContainer.setId(taskId);
taskContainer.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
taskContainer.setValue(Task.DETAILS_DATE, DateUtilities.now());
PluginServices.getTaskService().save(taskContainer);
taskContainer.clear();
}
// --- task cascading operations

@ -139,7 +139,7 @@ public class SubtasksUpdater extends OrderedListUpdater<String> {
metadata.setValue(SubtasksMetadata.ORDER, order);
metadata.setValue(SubtasksMetadata.INDENT, indent);
saveAndUpdateModifiedDate(metadata, taskId);
saveAndUpdateModifiedDate(metadata);
previousIndent.set(indent);
previousOrder.set(order);

Loading…
Cancel
Save