Allow removing operations with errors only

This commit is contained in:
M66B 2018-12-11 19:07:29 +01:00
parent 186f5f2580
commit e1b52d113d
1 changed files with 8 additions and 5 deletions

View File

@ -25,6 +25,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -140,11 +141,13 @@ public class FragmentOperations extends FragmentEx {
@Override
protected Void onLoad(Context context, Bundle args) {
DB db = DB.getInstance(context);
EntityOperation operation = db.operation().getOperationFirst();
if (operation != null) {
if (operation.message != null)
db.message().setMessageUiHide(operation.message, false);
db.operation().deleteOperation(operation.id);
List<EntityOperation> ops = db.operation().getOperationsError();
Log.i(Helper.TAG, "Operations with error count=" + ops.size());
for (EntityOperation op : ops) {
Log.w(Helper.TAG, "Deleting operation=" + op.id + " error=" + op.error);
if (op.message != null)
db.message().setMessageUiHide(op.message, false);
db.operation().deleteOperation(op.id);
}
return null;
}