Skip to content

Commit

Permalink
Merge pull request #266 from ziyi105/bug-fix-remove-extra-error-msg-w…
Browse files Browse the repository at this point in the history
…hen-decoding-pantryStock

Remove extra error message for wrong pantryStock format
  • Loading branch information
DextheChik3n authored Nov 5, 2023
2 parents 9f783ee + 729f611 commit 4ff8517
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/main/java/seedu/cafectrl/storage/Decoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,11 @@ public static Pantry decodePantryStockData(ArrayList<String> encodedPantryStock)
*/
private static boolean isValidPantryStockFormat(String[] decodedPantryStock) {
if (decodedPantryStock.length != 3) {
ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA);
return false;
} else {
try {
Integer.parseInt(decodedPantryStock[1].trim());
} catch (NumberFormatException e) {
ui.showToUser(ErrorMessages.ERROR_IN_PANTRY_STOCK_DATA);
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/cafectrl/storage/Encoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static ArrayList<String> encodePantryStock(Pantry pantry) {
ArrayList<Ingredient> pantryStock = pantry.getPantryStock();
for (Ingredient ingredient : pantryStock) {
StringBuilder encodedIngredient = new StringBuilder();
encodedIngredient.append(ingredient.getName());
encodedIngredient.append(ingredient.getName().trim());
encodedIngredient.append(DIVIDER);
encodedIngredient.append(ingredient.getQty());
encodedIngredient.append(DIVIDER);
Expand Down

0 comments on commit 4ff8517

Please sign in to comment.