Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Delete Command #93

Merged

Conversation

dhruvir29
Copy link

No description provided.

@dhruvir29 dhruvir29 added this to the v1.3 milestone Oct 26, 2023
@dhruvir29 dhruvir29 requested review from ItsTYtan and a user October 26, 2023 03:49
@dhruvir29 dhruvir29 self-assigned this Oct 26, 2023
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me, a few minor changes, also need to fix the checkstyle

try {
this.recipeList.remove(recipe);
} catch (RecipeNotFoundException e) {
throw new RecipeNotFoundException();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fine not catching the exception here considering the exception was thrown in the previous level. It's a runtime exception so we don't necessarily need to catch it, same as other runtime exceptions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think throwing an exception is fine so that the code can catch and display the corresponding error if needed

// public void removeRecipe_recipeNotInRecipeBook_throwsRecipeNotFoundException() {
// recipeBook.addRecipe(COOKIES);
// assertThrows(RecipeNotFoundException.class, () -> recipeBook.removeRecipe(SPONGECAKE.getId()));
// }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tests could be ammended by removing the getId() method call

Copy link

@ItsTYtan ItsTYtan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the delete command test that I am not sure about, the rest seems fine to me, could fix the checkstyle and push again.

// Messages.format(ingredientToDelete));
//
// ModelManager expectedModel = new ModelManager(model.getInventory(), new UserPrefs());
// expectedModel.deleteIngredient(ingredientToDelete);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this actually checks that the item is missing because how the expected model is generated uses the same function of deleteIngredient. deleteIngredient function from the model could be faulty.

@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Attention: 32 lines in your changes are missing coverage. Please review.

Comparison is base (a18539a) 66.41% compared to head (9f5832c) 64.93%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #93      +/-   ##
============================================
- Coverage     66.41%   64.93%   -1.49%     
+ Complexity      459      456       -3     
============================================
  Files            83       85       +2     
  Lines          1587     1614      +27     
  Branches        133      134       +1     
============================================
- Hits           1054     1048       -6     
- Misses          483      516      +33     
  Partials         50       50              
Files Coverage Δ
src/main/java/seedu/address/logic/Messages.java 83.33% <ø> (ø)
src/main/java/seedu/address/model/Model.java 100.00% <ø> (ø)
...seedu/address/logic/parser/InventoryAppParser.java 76.19% <0.00%> (-3.81%) ⬇️
...rc/main/java/seedu/address/model/ModelManager.java 84.72% <0.00%> (ø)
src/main/java/seedu/address/model/RecipeBook.java 65.78% <0.00%> (-13.70%) ⬇️
...eedu/address/logic/parser/DeleteCommandParser.java 0.00% <0.00%> (ø)
...va/seedu/address/logic/commands/DeleteCommand.java 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@prawnzyy prawnzyy merged commit 46bfb6c into AY2324S1-CS2103T-F10-3:master Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants