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