From 7871dcdfe594e6d34de7d9cdaca99adc15b580b6 Mon Sep 17 00:00:00 2001 From: Cazh1 Date: Mon, 6 Nov 2023 23:49:02 +0800 Subject: [PATCH 1/4] Add assertion into CafeCtrl --- src/main/java/seedu/cafectrl/CafeCtrl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java index c2fe25111b..dc5917487d 100644 --- a/src/main/java/seedu/cafectrl/CafeCtrl.java +++ b/src/main/java/seedu/cafectrl/CafeCtrl.java @@ -35,6 +35,7 @@ private CafeCtrl() { this.pantry = this.storage.loadPantryStock(); this.sales = this.storage.loadOrderList(menu); this.currentDate = new CurrentDate(sales); + assert !sales.getOrderLists().isEmpty(); } /** From 49e9608243bfa7c93bdcd46b626cd5c0aa9859d2 Mon Sep 17 00:00:00 2001 From: ZH Date: Tue, 7 Nov 2023 13:50:03 +0800 Subject: [PATCH 2/4] Update assertion --- src/main/java/seedu/cafectrl/CafeCtrl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/cafectrl/CafeCtrl.java b/src/main/java/seedu/cafectrl/CafeCtrl.java index dc5917487d..ad4656fc78 100644 --- a/src/main/java/seedu/cafectrl/CafeCtrl.java +++ b/src/main/java/seedu/cafectrl/CafeCtrl.java @@ -35,7 +35,8 @@ private CafeCtrl() { this.pantry = this.storage.loadPantryStock(); this.sales = this.storage.loadOrderList(menu); this.currentDate = new CurrentDate(sales); - assert !sales.getOrderLists().isEmpty(); + + assert sales.getOrderLists().size() == currentDate.getCurrentDay() + 1; } /** From 24b61e1ad4c7fb0010faaac7b8a7f281dae027b9 Mon Sep 17 00:00:00 2001 From: ZH Date: Tue, 7 Nov 2023 13:51:04 +0800 Subject: [PATCH 3/4] Refactor code to remove unused code --- src/main/java/seedu/cafectrl/data/Chef.java | 2 -- src/main/java/seedu/cafectrl/data/Sales.java | 5 ----- src/main/java/seedu/cafectrl/parser/Parser.java | 16 ---------------- 3 files changed, 23 deletions(-) diff --git a/src/main/java/seedu/cafectrl/data/Chef.java b/src/main/java/seedu/cafectrl/data/Chef.java index 6aa69090b5..9f19344fcc 100644 --- a/src/main/java/seedu/cafectrl/data/Chef.java +++ b/src/main/java/seedu/cafectrl/data/Chef.java @@ -34,6 +34,4 @@ public void cookDish() { ui.showToUser(e.getMessage()); } } - - } diff --git a/src/main/java/seedu/cafectrl/data/Sales.java b/src/main/java/seedu/cafectrl/data/Sales.java index cf187787c8..09b90fecd4 100644 --- a/src/main/java/seedu/cafectrl/data/Sales.java +++ b/src/main/java/seedu/cafectrl/data/Sales.java @@ -35,11 +35,6 @@ public void addOrderList(OrderList orderList) { orderLists.add(orderList); } - //TODO: @Zhong Heng, Remove this method if not used - public void removeOrderList(int orderListId) { - orderLists.remove(orderListId); - } - public void nextDay() { this.daysAccounted += 1; } diff --git a/src/main/java/seedu/cafectrl/parser/Parser.java b/src/main/java/seedu/cafectrl/parser/Parser.java index c41951926c..a69d878d96 100644 --- a/src/main/java/seedu/cafectrl/parser/Parser.java +++ b/src/main/java/seedu/cafectrl/parser/Parser.java @@ -568,22 +568,6 @@ private static OrderList setOrderList(CurrentDate currentDate, Sales sales) { return sales.getOrderList(currentDay); } - //@@author Cazh1 - /** - * Parses the given arguments string to identify task index number. - * - * @param userInput arguments string to parse as index number - * @param command expected String name of the command called - * @return the parsed index number - * @throws ParseException if no region of the args string could be found for the index - * @throws NumberFormatException the args string region is not a valid number - */ - private static int parseArgsAsDisplayedIndex(String userInput, String command) - throws ParseException, NumberFormatException { - String formattedString = userInput.replace(command, "").trim(); - return Integer.parseInt(formattedString); - } - //@@author ShaniceTang /** * Extracts the quantity (numeric part) from a given string containing both quantity and unit. From b8648a52c15dd980947516a03a36c35a357a37d6 Mon Sep 17 00:00:00 2001 From: ZH Date: Tue, 7 Nov 2023 14:13:12 +0800 Subject: [PATCH 4/4] Update code to remove unused import --- src/main/java/seedu/cafectrl/parser/Parser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/seedu/cafectrl/parser/Parser.java b/src/main/java/seedu/cafectrl/parser/Parser.java index a69d878d96..1448eaa99e 100644 --- a/src/main/java/seedu/cafectrl/parser/Parser.java +++ b/src/main/java/seedu/cafectrl/parser/Parser.java @@ -31,7 +31,6 @@ import seedu.cafectrl.data.dish.Ingredient; import seedu.cafectrl.ui.Ui; -import java.text.ParseException; import java.util.ArrayList; import java.util.regex.Matcher; import java.util.regex.Pattern;