From 729f6115805aa2ad94a8c07f92c00d54607188e2 Mon Sep 17 00:00:00 2001 From: ziyi105 Date: Sun, 5 Nov 2023 10:29:59 +0800 Subject: [PATCH] Remove extra error message for wrong pantryStock format --- src/main/java/seedu/cafectrl/storage/Decoder.java | 2 -- src/main/java/seedu/cafectrl/storage/Encoder.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/seedu/cafectrl/storage/Decoder.java b/src/main/java/seedu/cafectrl/storage/Decoder.java index f1794b578f..4c7067cbf4 100644 --- a/src/main/java/seedu/cafectrl/storage/Decoder.java +++ b/src/main/java/seedu/cafectrl/storage/Decoder.java @@ -95,13 +95,11 @@ public static Pantry decodePantryStockData(ArrayList 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; } } diff --git a/src/main/java/seedu/cafectrl/storage/Encoder.java b/src/main/java/seedu/cafectrl/storage/Encoder.java index 92e0bab277..ec5c01d7a7 100644 --- a/src/main/java/seedu/cafectrl/storage/Encoder.java +++ b/src/main/java/seedu/cafectrl/storage/Encoder.java @@ -67,7 +67,7 @@ public static ArrayList encodePantryStock(Pantry pantry) { ArrayList 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);