Merge remote-tracking branch 'origin/dev' into combo-scripter-v2
* origin/dev: fix storing food to the database remove forgotten log delete all dbrequests from query
This commit is contained in:
commit
01d49f9e52
|
@ -507,7 +507,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteDbRequestbyMongoId(String action, String id) {
|
public void deleteDbRequestbyMongoId(String action, String id) {
|
||||||
try {
|
try {
|
||||||
QueryBuilder<DbRequest, String> queryBuilder = getDaoDbRequest().queryBuilder();
|
QueryBuilder<DbRequest, String> queryBuilder = getDaoDbRequest().queryBuilder();
|
||||||
Where where = queryBuilder.where();
|
Where where = queryBuilder.where();
|
||||||
|
@ -515,16 +515,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||||
queryBuilder.limit(10L);
|
queryBuilder.limit(10L);
|
||||||
PreparedQuery<DbRequest> preparedQuery = queryBuilder.prepare();
|
PreparedQuery<DbRequest> preparedQuery = queryBuilder.prepare();
|
||||||
List<DbRequest> dbList = getDaoDbRequest().query(preparedQuery);
|
List<DbRequest> dbList = getDaoDbRequest().query(preparedQuery);
|
||||||
if (dbList.size() != 1) {
|
log.error("deleteDbRequestbyMongoId query size: " + dbList.size());
|
||||||
log.error("deleteDbRequestbyMongoId query size: " + dbList.size());
|
for (DbRequest r : dbList) {
|
||||||
} else {
|
delete(r);
|
||||||
//log.debug("Treatment findTreatmentById found: " + trList.get(0).log());
|
|
||||||
return delete(dbList.get(0));
|
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteAllDbRequests() {
|
public void deleteAllDbRequests() {
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class FoodHelper {
|
||||||
public boolean createOrUpdate(Food food) {
|
public boolean createOrUpdate(Food food) {
|
||||||
try {
|
try {
|
||||||
// find by NS _id
|
// find by NS _id
|
||||||
if (food._id != null) {
|
if (food._id != null && !food._id.equals("")) {
|
||||||
Food old;
|
Food old;
|
||||||
|
|
||||||
QueryBuilder<Food, Long> queryBuilder = getDaoFood().queryBuilder();
|
QueryBuilder<Food, Long> queryBuilder = getDaoFood().queryBuilder();
|
||||||
|
@ -90,12 +90,13 @@ public class FoodHelper {
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
getDaoFood().createOrUpdate(food);
|
||||||
|
log.debug("FOOD: New record: " + food.toString());
|
||||||
|
scheduleFoodChange();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDaoFood().createOrUpdate(food);
|
|
||||||
log.debug("FOOD: New record: " + food.toString());
|
|
||||||
scheduleFoodChange();
|
|
||||||
return true;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,6 @@ public class FoodFragment extends SubscriberFragment {
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
try {
|
try {
|
||||||
View view = inflater.inflate(R.layout.food_fragment, container, false);
|
View view = inflater.inflate(R.layout.food_fragment, container, false);
|
||||||
|
|
||||||
filter = (EditText) view.findViewById(R.id.food_filter);
|
filter = (EditText) view.findViewById(R.id.food_filter);
|
||||||
clearFilter = (ImageView) view.findViewById(R.id.food_clearfilter);
|
clearFilter = (ImageView) view.findViewById(R.id.food_clearfilter);
|
||||||
category = new SpinnerHelper(view.findViewById(R.id.food_category));
|
category = new SpinnerHelper(view.findViewById(R.id.food_category));
|
||||||
|
|
Loading…
Reference in a new issue