Skip to content
This repository has been archived by the owner on Jul 1, 2019. It is now read-only.

Commit

Permalink
Fix could not delete recipe ingredient problem
Browse files Browse the repository at this point in the history
  • Loading branch information
DRJ31 committed May 12, 2019
1 parent 76d4159 commit bd863e2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/model/Recipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public boolean insert() {
@Override
public boolean delete() {
DatabaseHelper dbHelper = new DatabaseHelper();
boolean status;
boolean status = true;
String query = String.format("DELETE FROM Recipe WHERE Recipe_ID=%d", this.getID());

try {
Expand All @@ -225,13 +225,9 @@ public boolean delete() {
e.printStackTrace();
return false;
}
for (RecipeIngredient ingredient : ingredients) {
status = ingredient.delete();
if (!status)
return false;
}
status = RecipeIngredient.deleteAll(this.getID());
notifyListener();
return true;
return status;
}

@Override
Expand Down

0 comments on commit bd863e2

Please sign in to comment.