From 2bbe983152a72445672c68edcac7966b558087d0 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 21:53:40 +0800 Subject: [PATCH 01/13] Checkstyle and bug fixes --- docs/AboutUs.md | 2 +- docs/UserGuide.md | 20 ++++- src/main/java/seedu/simplst/Display.java | 39 ++-------- src/main/java/seedu/simplst/LocalStorage.java | 3 - src/main/java/seedu/simplst/Order.java | 15 ++-- src/main/java/seedu/simplst/Orderline.java | 11 +-- src/main/java/seedu/simplst/UnitGood.java | 8 +- src/main/java/seedu/simplst/Warehouse.java | 44 +++-------- .../java/seedu/simplst/parsers/AddParser.java | 15 +--- .../seedu/simplst/parsers/FindParser.java | 2 +- .../seedu/simplst/parsers/FulfillParser.java | 2 +- .../seedu/simplst/parsers/HelpParser.java | 7 +- .../seedu/simplst/parsers/ListParser.java | 2 +- .../seedu/simplst/parsers/RemoveParser.java | 2 +- .../simplst/parsers/StoreCapacityParser.java | 31 -------- .../seedu/simplst/parsers/ViewParser.java | 2 +- src/test/java/seedu/simplst/CommandsTest.java | 73 ------------------- src/test/java/seedu/simplst/OrderTest.java | 8 +- .../java/seedu/simplst/OrderlineTest.java | 4 +- 19 files changed, 59 insertions(+), 231 deletions(-) delete mode 100644 src/main/java/seedu/simplst/parsers/StoreCapacityParser.java delete mode 100644 src/test/java/seedu/simplst/CommandsTest.java diff --git a/docs/AboutUs.md b/docs/AboutUs.md index b12084bb42..30e12928a5 100644 --- a/docs/AboutUs.md +++ b/docs/AboutUs.md @@ -4,6 +4,6 @@ | ![](https://via.placeholder.com/100.png?text=Photo) | Nnythingy | [Github](https://github.com/Nnythingy) | [Portfolio](team/nnythingy.md) | | ![](https://via.placeholder.com/100.png?text=Photo) | Shyun Yin | [Github](https://github.com/Shyunyin) | [Portfolio](team/johndoe.md) | | ![](https://via.placeholder.com/100.png?text=Photo) | Tuan | [Github](https://github.com/tuan0369) | [Portfolio](team/johndoe.md) | -| ![](https://via.placeholder.com/100.png?text=Photo) | Haziq Hakim | [Github](https://github.com/LDerpy) | [Portfolio](team/lderpy.md) | +| ![](https://via.placeholder.com/100.png?text=Photo) | Haziq Hakim | [Github](https://github.com/LDerpy) | [Portfolio](team/lderpy.md) | | ![](https://via.placeholder.com/100.png?text=Photo) | Jun Leong | [Github](https://github.com/hjunleon) | [Portfolio](team/johndoe.md) | diff --git a/docs/UserGuide.md b/docs/UserGuide.md index acbb01fdb5..811d141363 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -12,6 +12,7 @@ setup and quick to use. Simplst will mainly be used to add, remove, list and vie * [Explanation of Key Terms or Symbols](#explanation-of-key-terms-or-symbols) * [Quick start](#quick-start) * [Features](#features) + * [Help Command]() * [Unit Good Commands](#unit-good-commands) * [Adding a Unit Good](#adding-a-unit-good-add-ug) * [Removing a Unit Good](#removing-a-unit-good-remove-ug) @@ -76,15 +77,26 @@ ____________________________________________________________ ## Features +### Help Command `help` +All the features can be viewed on the Command-Line Interface using the help command if you want to view the commands +there instead. This is done by using the `help` command. You can also use flags to indicate which specific set of commands +to view. + +Help Commands: +* `help` - View all commands +* `help ug` - View commands related to Unit Goods +* `help g` - View commands related to Goods +* `help o` - View commands related to Orders and Orderlines + ### ***Unit Good Commands*** A Unit Good is a template of a good. A unit good should be added to the warehouse to allow Simplst to know what kind goods will be added to the warehouse later. Unit Goods can help Simplst to estimate storage capacity in the future and other predicitive features for future versions. A Unit Good contains: -* unique SKU -* name -* description of unit good -* capacity +* Unique SKU +* Name +* Description of unit good +* Capacity ### Adding a Unit Good `add ug/` Add a new unit good to the warehouse, creating a Good with quantity 0 in the process. diff --git a/src/main/java/seedu/simplst/Display.java b/src/main/java/seedu/simplst/Display.java index c68056aa56..7713ba2dcc 100644 --- a/src/main/java/seedu/simplst/Display.java +++ b/src/main/java/seedu/simplst/Display.java @@ -1,35 +1,6 @@ package seedu.simplst; public class Display { - - // public static void addGood(String id, String name, String qty, - // String desc, ArrayList userOrderlines) throws WrongCommandException { - // if (id.isBlank() || name.isBlank() || qty.isBlank()) { - // throw new WrongCommandException("add", true); - // } - // try { - // Orderline orderline = new Orderline( - // Integer.parseInt(id), - // name, - // Integer.parseInt(qty), - // desc); - // userOrderlines.add(orderline); - // System.out.printf("%d %s %s added\n", orderline.getQuantity(), orderline, - // checkPlural(orderline.getQuantity())); - // } catch (NumberFormatException e) { - // throw new WrongCommandException("add", true); - // } - // } - - // Function to print grammar for statements to print - // public static String checkPlural(int numberOfGoods) { - // if (numberOfGoods <= 1) { - // return "is "; - // } else { - // return "are "; - // } - // } - public static void hello() { String logo = "Simplst"; System.out.println("Hello from\n" + logo); @@ -117,7 +88,7 @@ public static void warehouseStateNotSaved() { System.out.println("Warehouse information can't save."); } - public static void warehouseStateNotRestored(){ + public static void warehouseStateNotRestored() { System.out.println("Warehouse information can't restore."); } @@ -184,15 +155,15 @@ public static void helpOrder() { System.out.println("\tExample: add o/ oid/1 r/Danny Phantom " + "addr/Amity Park\n"); System.out.println("Add good to order Command"); - System.out.println("\tFormat: add og/ oid/[ORDER_ID] sku/[SKU] q/[QUANTITY_NEEDED_FOR_ORDER]"); - System.out.println("\tExample: add og/ oid/1 sku/WC1 q/10"); + System.out.println("\tFormat: add og/ oid/[ORDER_ID] sku/[SKU] qty/[QUANTITY_NEEDED_FOR_ORDER]"); + System.out.println("\tExample: add og/ oid/1 sku/WC1 qty/10\n"); System.out.println("Remove order Command"); System.out.println("\tFormat: remove o/ oid/[ORDER_ID]"); System.out.println("\tExample: remove o/ oid/1\n"); System.out.println("Remove a specific quantity of orderline in an order"); System.out.println("\tFormat: remove og/ oid/[ORDER_ID] sku/[SKU]" - + " q/[QUANTITY_TO_REMOVE]"); - System.out.println("\tExample: remove og/ oid/1 sku/WC1 q/1\n"); + + " qty/[QUANTITY_TO_REMOVE]"); + System.out.println("\tExample: remove og/ oid/1 sku/WC1 qty/1\n"); System.out.println("Listing all orders"); System.out.println("\tFormat: list o/\n"); System.out.println("Listing orderlines in an order"); diff --git a/src/main/java/seedu/simplst/LocalStorage.java b/src/main/java/seedu/simplst/LocalStorage.java index c068696ca5..a3604008e6 100644 --- a/src/main/java/seedu/simplst/LocalStorage.java +++ b/src/main/java/seedu/simplst/LocalStorage.java @@ -79,10 +79,7 @@ public void writeSaveFile(String storeStr) { } public static Boolean writeSaveFile(String storeStr, String filePath) throws IOException { -// System.out.println("filePath: " + filePath); Path dir = Paths.get(filePath).toAbsolutePath().normalize().getParent(); -// System.out.println("dir: "); -// System.out.println(dir); if (!Files.exists(dir)) { //createTempDirectory try { Files.createDirectory(dir); diff --git a/src/main/java/seedu/simplst/Order.java b/src/main/java/seedu/simplst/Order.java index 7a86684a40..1eec31cf76 100644 --- a/src/main/java/seedu/simplst/Order.java +++ b/src/main/java/seedu/simplst/Order.java @@ -62,8 +62,7 @@ public Orderline addOrderline(UnitGood unitGood, String qty) Display.orderlineAlreadyExists(orderline.getName(), orderline.getQuantity()); return null; } - orderline = new Orderline(unitGood, - orderlines.size() + 1, quantity); + orderline = new Orderline(unitGood, quantity); orderlines.add(orderline); Display.orderlineAdded(orderline.getName(), orderline.getQuantity()); } catch (NumberFormatException e) { @@ -190,7 +189,7 @@ public static Order restoreOrder(JSONObject jo) { Object saO = jo.get(OrderKeys.shippingAddress); Object fO = jo.get(OrderKeys.isFulfilled); Object olO = jo.get(OrderKeys.orderlines); - if (idO == null || rO == null || saO == null || fO == null || olO == null){ + if (idO == null || rO == null || saO == null || fO == null || olO == null) { return null; } Integer orderId = Integer.parseInt(idO.toString()); @@ -204,26 +203,26 @@ public static Order restoreOrder(JSONObject jo) { cur.setFulfilled(Boolean.parseBoolean(fO.toString())); JSONArray orderLinesJA = (JSONArray) olO; - for (Object item: orderLinesJA){ + for (Object item: orderLinesJA) { JSONObject jol = (JSONObject) item; UnitGood ug = UnitGood.restoreUnitGood(jol); - if (ug == null){ + if (ug == null) { return null; } Object qtyO = jol.get(GoodKeys.quantity); Object qfO = jol.get(OrderlinesKeys.quantityFulfilled); Object ifO = jol.get(OrderlinesKeys.isCheckedOff); - if (qtyO == null || qfO == null || ifO == null){ + if (qtyO == null || qfO == null || ifO == null) { return null; } String qty = qtyO.toString(); try { Orderline ol = cur.addOrderline(ug, qty); - if (ol == null){ + if (ol == null) { return null; } Boolean isCheckOff = Boolean.parseBoolean(ifO.toString()); - if (isCheckOff){ + if (isCheckOff) { ol.checkOff(); } Integer qtyF = Integer.parseInt(qfO.toString()); diff --git a/src/main/java/seedu/simplst/Orderline.java b/src/main/java/seedu/simplst/Orderline.java index 54c499623c..a4964a5274 100644 --- a/src/main/java/seedu/simplst/Orderline.java +++ b/src/main/java/seedu/simplst/Orderline.java @@ -15,7 +15,7 @@ public class Orderline extends Good { private int quantityFulfilled = 0; private Boolean isCheckedOff = false; - public Orderline(UnitGood unitGood, int id, int quantity) { + public Orderline(UnitGood unitGood, int quantity) { super(unitGood, quantity); } @@ -32,7 +32,7 @@ public void setQuantityFulfilled(int quantityFulfilled) { if (quantityFulfilled == super.getQuantity()) { checkOff(); } -} + } private String isDone() { if (isCheckedOff) { @@ -52,15 +52,8 @@ public String toString() { + isDone(); } - public int getId() { - return 0; - } - public JSONObject serialize() { JSONObject jo = super.serialize(); -// System.out.println("Serializee orderline"); -// System.out.println(this.isCheckedOff); -// System.out.println(this.quantityFulfilled); jo.put(OrderlinesKeys.isCheckedOff, this.isCheckedOff); jo.put(OrderlinesKeys.quantityFulfilled, this.quantityFulfilled); return jo; diff --git a/src/main/java/seedu/simplst/UnitGood.java b/src/main/java/seedu/simplst/UnitGood.java index 0de6f1597f..491970cb9a 100644 --- a/src/main/java/seedu/simplst/UnitGood.java +++ b/src/main/java/seedu/simplst/UnitGood.java @@ -86,18 +86,14 @@ public static UnitGood restoreUnitGood(JSONObject jo) { Object description = jo.get(UnitGoodKeys.description); Object capacity = jo.get(UnitGoodKeys.capacity); String desc = ""; - if (sku == null || name == null || capacity == null){ + if (sku == null || name == null || capacity == null) { return null; } - if(description == null){ + if (description == null) { desc = ""; } else { desc = description.toString(); } -// System.out.println("sku: " + sku); -// System.out.println("name: " + name); -// System.out.println("description: " + description); -// System.out.println("capacity: " + capacity); UnitGood ug = new UnitGood( sku.toString(), name.toString(), diff --git a/src/main/java/seedu/simplst/Warehouse.java b/src/main/java/seedu/simplst/Warehouse.java index 678091e400..ed87c25bc6 100644 --- a/src/main/java/seedu/simplst/Warehouse.java +++ b/src/main/java/seedu/simplst/Warehouse.java @@ -10,7 +10,6 @@ import util.exceptions.InvalidObjectType; import util.exceptions.ItemDoesNotExistException; import util.exceptions.LargeQuantityException; -import util.exceptions.UnitTestException; import util.exceptions.WrongCommandException; import java.io.IOException; @@ -100,12 +99,6 @@ public Boolean addQuantityOfGoodToInventory(String sku, String qty) return true; } - - // Meant for batch adding goods, could be used with UI if i create a param map. - public void addGoodToInventory(int id, Object goodObject) { - - } - public Boolean addOrderline(String oid, String sku, String qty) throws WrongCommandException { Boolean status = true; try { @@ -135,7 +128,7 @@ private Boolean addGoodToOrder(Order order, String sku, String qty) throws Wrong } Orderline ol = order.addOrderline(getUnitGoodBySku(sku), qty); - if (ol == null){ + if (ol == null) { return false; } return true; @@ -512,23 +505,6 @@ public void batchSetOrders(String filePath) throws WrongCommandException, Invali } } - /** - * Adds all stuff in a csv or json (it's either one). - * - * @param filePath path to file - * @throws InvalidFileException Invalid File - */ - public void batchSetGoodsToInventory(String filePath) throws InvalidFileException { - // READ JSON FILE - - JSONArray jsonGoods = new JSONArray(); - int idx = 0; - for (Object goodObject : jsonGoods) { - addGoodToInventory(idx, goodObject); - idx += 1; - } - } - private boolean hasOrderId(int oid) { for (Order order : orderLists) { if (order.getId() == oid) { @@ -649,7 +625,7 @@ public boolean setTotalCapacity(String input) { + " than input capacity"); } catch (NumberFormatException numberFormatException) { System.out.println("Please set the Warehouse capacity again."); - } catch (NullPointerException e){ + } catch (NullPointerException e) { System.out.println("Warehouse capacity can't be null"); } return false; @@ -701,7 +677,7 @@ private Boolean restoreOrders(JSONArray ja) { for (Object o : ja) { JSONObject jo = (JSONObject) o; Order restoredOrder = Order.restoreOrder(jo); - if (restoredOrder == null){ + if (restoredOrder == null) { return false; } status = this.addOrder(restoredOrder); @@ -732,7 +708,7 @@ private Boolean restoreGoods(JSONObject jo) { String sku = ko.toString(); JSONObject jg = (JSONObject) jo.get(ko); UnitGood ug = UnitGood.restoreUnitGood(jg); - if (ug==null){ + if (ug == null) { return false; } status = this.addUnitGoodToInventory(ug); @@ -740,7 +716,7 @@ private Boolean restoreGoods(JSONObject jo) { return false; } Object qtyO = (jg).get(GoodKeys.quantity); - if (qtyO == null){ + if (qtyO == null) { return false; } String qty = qtyO.toString(); @@ -810,7 +786,7 @@ public Boolean restoreWarehouseState() { JSONObject jsonWarehouse = (JSONObject) JSONValue.parseWithException(saveStr); boolean status = false; Object capO = jsonWarehouse.get(WarehouseKeys.totalCapacity); - if (capO == null){ + if (capO == null) { return false; } status = this.setTotalCapacity(capO.toString()); @@ -818,20 +794,20 @@ public Boolean restoreWarehouseState() { return false; } Object olO = jsonWarehouse.get(WarehouseKeys.orderLists); - if (olO == null){ + if (olO == null) { return false; } - JSONArray sol = (JSONArray) olO ; + JSONArray sol = (JSONArray) olO; status = this.restoreOrders(sol); if (!status) { return false; } Object glO = jsonWarehouse.get(WarehouseKeys.goodList); - if (glO == null){ + if (glO == null) { return false; } JSONObject sgl = (JSONObject) glO; - if (sgl == null){ + if (sgl == null) { return false; } status = this.restoreGoods(sgl); diff --git a/src/main/java/seedu/simplst/parsers/AddParser.java b/src/main/java/seedu/simplst/parsers/AddParser.java index 231da47f93..d856fe352d 100644 --- a/src/main/java/seedu/simplst/parsers/AddParser.java +++ b/src/main/java/seedu/simplst/parsers/AddParser.java @@ -27,7 +27,7 @@ public AddParser(Warehouse warehouse, String userInput) { public void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "(?[ugbo]{1,2})/"; + regex = " (?[ugbo]{1,2})/"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } @@ -66,18 +66,7 @@ public void extractParams() throws WrongCommandException, InvalidFileException, userInput, regexOrderline).getGroupValues(); warehouse.addOrderline(regexOrderlineMatch.get("oid"), regexOrderlineMatch.get("sku"), regexOrderlineMatch.get("qty")); - } else if (matches.get("flag").equals("bg")) { - // batch goods - String regexBatchGoods = "fp/(?.*)"; - HashMap regexBatchGoodsMatch = new - MatchKeywords(userInput, regexBatchGoods).getGroupValues(); - warehouse.batchSetGoodsToInventory(regexBatchGoodsMatch.get("filepath")); - } else if (matches.get("flag").equals("bo")) { - // batch goods - String regexBatchGoods = "fp/(?.*)"; - HashMap regexBatchGoodsMatch = new - MatchKeywords(userInput, regexBatchGoods).getGroupValues(); - warehouse.batchSetOrders(regexBatchGoodsMatch.get("filepath")); + } else { throw new WrongCommandException("add", true); } diff --git a/src/main/java/seedu/simplst/parsers/FindParser.java b/src/main/java/seedu/simplst/parsers/FindParser.java index 3812360730..41c59f849d 100644 --- a/src/main/java/seedu/simplst/parsers/FindParser.java +++ b/src/main/java/seedu/simplst/parsers/FindParser.java @@ -21,7 +21,7 @@ public FindParser(Warehouse warehouse, String userInput) { public void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "n/(?.*)"; + regex = " n/(?.*)"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } diff --git a/src/main/java/seedu/simplst/parsers/FulfillParser.java b/src/main/java/seedu/simplst/parsers/FulfillParser.java index d61618d4d7..5f65162dd2 100644 --- a/src/main/java/seedu/simplst/parsers/FulfillParser.java +++ b/src/main/java/seedu/simplst/parsers/FulfillParser.java @@ -14,7 +14,7 @@ public FulfillParser(Warehouse warehouse) { protected void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "oid/(?\\d*)"; + regex = " oid/(?\\d*)"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } diff --git a/src/main/java/seedu/simplst/parsers/HelpParser.java b/src/main/java/seedu/simplst/parsers/HelpParser.java index c299d1b983..cebcb86099 100644 --- a/src/main/java/seedu/simplst/parsers/HelpParser.java +++ b/src/main/java/seedu/simplst/parsers/HelpParser.java @@ -26,12 +26,10 @@ public boolean isNoFlag() { @Override public void initExtractParams() throws MissingFlagException, EmptyFieldException { - System.out.println(this.userInput); - System.out.println(isNoFlag); if (!this.userInput.equalsIgnoreCase("help")) { //for help commands with flag MatchKeywords matchKeywordsMatch; String regex; - regex = "(?[uog]{1,2})"; + regex = " (?[uog]{1,2})$"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } else { @@ -56,7 +54,8 @@ protected void extractParams() { Display.helpOrder(); break; default: - System.out.println("Refer to user guide for instructions on help command."); + System.out.println("Refer to user guide for instructions on help command flags."); + Display.help(); } } isNoFlag = false; //reset diff --git a/src/main/java/seedu/simplst/parsers/ListParser.java b/src/main/java/seedu/simplst/parsers/ListParser.java index dafbafcc3a..830b82a461 100644 --- a/src/main/java/seedu/simplst/parsers/ListParser.java +++ b/src/main/java/seedu/simplst/parsers/ListParser.java @@ -22,7 +22,7 @@ public ListParser(Warehouse warehouse, String userInput) { public void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "(?[uog]{1,2})/"; + regex = " (?[uog]{1,2})/"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } diff --git a/src/main/java/seedu/simplst/parsers/RemoveParser.java b/src/main/java/seedu/simplst/parsers/RemoveParser.java index f682e3b87a..2d29dccbf8 100644 --- a/src/main/java/seedu/simplst/parsers/RemoveParser.java +++ b/src/main/java/seedu/simplst/parsers/RemoveParser.java @@ -22,7 +22,7 @@ public RemoveParser(Warehouse warehouse, String userInput) { public void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "(?[uog]{1,2})/"; + regex = " (?[uog]{1,2})/"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } diff --git a/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java b/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java deleted file mode 100644 index 284126374f..0000000000 --- a/src/main/java/seedu/simplst/parsers/StoreCapacityParser.java +++ /dev/null @@ -1,31 +0,0 @@ -//package seedu.duke.CommandParsers; -// -//import seedu.duke.Regex; -//import seedu.duke.Warehouse; -//import util.exceptions.WrongCommandException; -// -//public class StoreCapacityParser extends CommandParser{ -// public StoreCapacityParser(Warehouse warehouse) { -// super(warehouse); -// } -// -// protected void init_extract_params(){ -// Regex regexMatch; -// String regex; -// regex = "(?[og])/"; -// regexMatch = new Regex(this.userInput, regex); -// this.matches = regexMatch.getGroupValues(); -// }; -// protected void extract_params() throws WrongCommandException { -// if (matches.get("flag").equals("o")) { -// // list orders with flag "o/" -// this.warehouse.listOrders(); -// } else if (matches.get("flag").equals("g")) { -// // list goods with flag "g/" -// this.warehouse.listGoods(); // refers to inventory goods -// } else { -// // wrong command exception -// throw new WrongCommandException("list", true); -// } -// }; -//} diff --git a/src/main/java/seedu/simplst/parsers/ViewParser.java b/src/main/java/seedu/simplst/parsers/ViewParser.java index 590257cf13..52e7e3f1c7 100644 --- a/src/main/java/seedu/simplst/parsers/ViewParser.java +++ b/src/main/java/seedu/simplst/parsers/ViewParser.java @@ -22,7 +22,7 @@ public ViewParser(Warehouse warehouse, String userInput) { public void initExtractParams() throws MissingFlagException, EmptyFieldException { MatchKeywords matchKeywordsMatch; String regex; - regex = "(?[uog]{1,2})/"; + regex = " (?[uog]{1,2})/"; matchKeywordsMatch = new MatchKeywords(this.userInput, regex); this.matches = matchKeywordsMatch.getGroupValues(); } diff --git a/src/test/java/seedu/simplst/CommandsTest.java b/src/test/java/seedu/simplst/CommandsTest.java deleted file mode 100644 index 21bb71f02b..0000000000 --- a/src/test/java/seedu/simplst/CommandsTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package seedu.simplst; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertThrows; -/* -class CommandsTest { - @Test - public void addGoodTest() { - //test 1, adding good normally - success - ArrayList goodsArrayList = new ArrayList<>(); - Commands.addGood("1", "chairs", "15", "they are chairs", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - - - //test 2, adding non-unique id with different name - fail, good is not added - Commands.addGood("1", "tables", "15", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - - - goodsArrayList = new ArrayList<>(); - //test 3, blank inputs - fail, good is not added - Commands.addGood("1", " ", "15", "no face, no name, no number", goodsArrayList); - assertEquals(0, goodsArrayList.size()); - - //test 4, empty inputs - fail, good is not added - Commands.addGood("1", "bananas", "15", "", goodsArrayList); - assertEquals(0, goodsArrayList.size()); - - //test 5, non-numerical inputs for id - fail, good is not added - Commands.addGood("hi", "chairs", "15", "hello", goodsArrayList); - assertEquals(0, goodsArrayList.size()); - } - - @Test - void removeGoodTest() { - ArrayList goodsArrayList = new ArrayList<>(); - Commands.addGood("1", "chairs", "15", "they are chairs", goodsArrayList); - Commands.addGood("2", "table", "15", "there are some table here", goodsArrayList); - - //test 1, delete all (15) chairs - success, only left tables in list - Commands.removeGood("1", "15", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - - //test 2, delete 1 table - success, 14 tables left - Commands.removeGood("2", "1", goodsArrayList); - assertEquals(14, goodsArrayList.get(0).getQuantity()); - - //test 3, delete 16 tables - fail, deleting more than expected - Commands.removeGood("2", "16", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - assertEquals(14, goodsArrayList.get(0).getQuantity()); - - //test 4, non-numerical inputs - fail, good is not deleted - Commands.removeGood("hi", "1", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - assertEquals(14, goodsArrayList.get(0).getQuantity()); - - //test 5, deleting good id that does not exist - fail - Commands.removeGood("4", "15", goodsArrayList); - assertEquals(1, goodsArrayList.size()); - assertEquals(14, goodsArrayList.get(0).getQuantity()); - } - - // @Test - // void totalGoodsTest(){ - // ArrayList goodsArrayList = new ArrayList<>(); - // Commands.addGood("1", "chairs", "15", goodsArrayList); - // Commands.addGood("2", "table", "15", goodsArrayList); - // - // - // } -} - */ \ No newline at end of file diff --git a/src/test/java/seedu/simplst/OrderTest.java b/src/test/java/seedu/simplst/OrderTest.java index 4c128cd125..0690fa93aa 100644 --- a/src/test/java/seedu/simplst/OrderTest.java +++ b/src/test/java/seedu/simplst/OrderTest.java @@ -41,9 +41,9 @@ void getShippingAddress() { @Test void getOrderlines() { - Orderline orderlineQuas = new Orderline(quas, 1, 3); - Orderline orderlineWex = new Orderline(wex, 2, 3); - Orderline orderlineExort = new Orderline(exort, 3, 3); + Orderline orderlineQuas = new Orderline(quas, 3); + Orderline orderlineWex = new Orderline(wex, 3); + Orderline orderlineExort = new Orderline(exort, 3); ArrayList orderlines = new ArrayList<>( Arrays.asList(orderlineQuas, orderlineWex, orderlineExort) ); @@ -72,7 +72,7 @@ void getOrderlines() { @Test void getOrderline() { - Orderline orderlineQuas = new Orderline(quas, 1, 3); + Orderline orderlineQuas = new Orderline(quas, 3); //test 1 - finding SKU that exists try { diff --git a/src/test/java/seedu/simplst/OrderlineTest.java b/src/test/java/seedu/simplst/OrderlineTest.java index 55ed1cc657..d08ce877b2 100644 --- a/src/test/java/seedu/simplst/OrderlineTest.java +++ b/src/test/java/seedu/simplst/OrderlineTest.java @@ -10,7 +10,7 @@ public void fulfilOrder_allQuantityFulfilled_isDone() { Order testOrder = new Order(1, "John Doe", "123 Maple ave"); UnitGood testUnitGood = new UnitGood("WC1", "Wooden Chairs", "German Oak", "small"); Good testGood = new Good(testUnitGood, 50); - Orderline testOrderline = new Orderline(testGood, 1, 20); + Orderline testOrderline = new Orderline(testGood, 20); testOrderline.setQuantityFulfilled(20); assertEquals(20, testOrderline.getQuantityFulfilled()); @@ -22,7 +22,7 @@ public void fulfilOrder_someQuantityFulfilled_isNotDone() { Order testOrder = new Order(2, "John Day", "321 Maple ave"); UnitGood testUnitGood = new UnitGood("WC2", "Wooden Table", "German Oak", "small"); Good testGood = new Good(testUnitGood, 50); - Orderline testOrderline = new Orderline(testGood, 2, 20); + Orderline testOrderline = new Orderline(testGood, 20); testOrderline.setQuantityFulfilled(10); assertEquals(false, testOrderline.getCheckedOff()); From 8df1748997e9d8c40f360314bb75005cb2c7fd56 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:05:20 +0800 Subject: [PATCH 02/13] Checkstyle fix --- src/main/java/seedu/simplst/Display.java | 17 +---------------- src/main/java/seedu/simplst/Simplst.java | 15 ++++++--------- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/main/java/seedu/simplst/Display.java b/src/main/java/seedu/simplst/Display.java index 7713ba2dcc..153f99ba99 100644 --- a/src/main/java/seedu/simplst/Display.java +++ b/src/main/java/seedu/simplst/Display.java @@ -8,33 +8,18 @@ public static void hello() { } public static void bye() { - System.out.println("Thanks for using Simplst 1.0!"); + System.out.println("Thanks for using Simplst 2.1!"); } public static void stateRestored() { System.out.println("State restored!"); } - public static void stateSaved() { - System.out.println("State saved!"); - } - - public static void stateNotSaved() { - System.out.println("State not saved!"); - } - public static void newLogin() { System.out.println("New login."); } // successful output - public static void inventoryGoodQtyRemoved(Float qty, String goodName) { - System.out.println(qty + " of " + goodName + " has been removed."); - } - - public static void orderlineCheckedOff(String unitGoodName, String orderId) { - System.out.println(unitGoodName + "of order " + orderId + " has been removed."); - } public static void unitGoodAdded(String sku) { System.out.println("Unit Good of SKU: " + sku + " added to warehouse"); diff --git a/src/main/java/seedu/simplst/Simplst.java b/src/main/java/seedu/simplst/Simplst.java index a0011a35c3..64230d0f5e 100644 --- a/src/main/java/seedu/simplst/Simplst.java +++ b/src/main/java/seedu/simplst/Simplst.java @@ -1,14 +1,12 @@ package seedu.simplst; -import util.exceptions.NullException; - import java.io.IOException; /** * Main entry-point for the java.duke.Duke application. */ public class Simplst { - public static void main(String[] args) throws NullException, IOException { + public static void main(String[] args) { UserInterface ui; Display.hello(); Warehouse w = new Warehouse(0); @@ -22,12 +20,11 @@ public static void main(String[] args) throws NullException, IOException { } ui = new UserInterface(w); ui.run(); - status = w.saveWarehouseState(); -// if (status) { -// Display.stateSaved(); -// } else { -// Display.stateNotSaved(); -// } + try { + w.saveWarehouseState(); + } catch (IOException e) { + System.out.println("File not saved!"); + } Display.bye(); } } From 9892195aa0e984751169770d63bc7f25482a4f02 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:15:10 +0800 Subject: [PATCH 03/13] checkstyle fix final v2.1 --- src/main/java/seedu/simplst/Order.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/seedu/simplst/Order.java b/src/main/java/seedu/simplst/Order.java index 1eec31cf76..7b1fabb441 100644 --- a/src/main/java/seedu/simplst/Order.java +++ b/src/main/java/seedu/simplst/Order.java @@ -185,15 +185,15 @@ public JSONObject serialize() { public static Order restoreOrder(JSONObject jo) { Object idO = jo.get(OrderKeys.orderId); - Object rO = jo.get(OrderKeys.receiver); + Object ro = jo.get(OrderKeys.receiver); Object saO = jo.get(OrderKeys.shippingAddress); - Object fO = jo.get(OrderKeys.isFulfilled); + Object fo = jo.get(OrderKeys.isFulfilled); Object olO = jo.get(OrderKeys.orderlines); - if (idO == null || rO == null || saO == null || fO == null || olO == null) { + if (idO == null || ro == null || saO == null || fo == null || olO == null) { return null; } Integer orderId = Integer.parseInt(idO.toString()); - String receiver = rO.toString(); + String receiver = ro.toString(); String shippingAddress = saO.toString(); Order cur = new Order( orderId, @@ -201,7 +201,7 @@ public static Order restoreOrder(JSONObject jo) { shippingAddress ); - cur.setFulfilled(Boolean.parseBoolean(fO.toString())); + cur.setFulfilled(Boolean.parseBoolean(fo.toString())); JSONArray orderLinesJA = (JSONArray) olO; for (Object item: orderLinesJA) { JSONObject jol = (JSONObject) item; From aebae479aa9d760c8f0b038ae88b9cc62d5c9a77 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:24:48 +0800 Subject: [PATCH 04/13] More checkstyle fixes --- src/test/java/seedu/simplst/AddParserTest.java | 4 ++-- src/test/java/seedu/simplst/RemoveParserTest.java | 2 +- src/test/java/seedu/simplst/StorageTest.java | 9 +++++---- src/test/java/seedu/simplst/ViewParserTest.java | 3 ++- src/test/java/seedu/simplst/WarehouseTest.java | 9 ++++----- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/test/java/seedu/simplst/AddParserTest.java b/src/test/java/seedu/simplst/AddParserTest.java index 8681949d8c..2043fd1a2a 100644 --- a/src/test/java/seedu/simplst/AddParserTest.java +++ b/src/test/java/seedu/simplst/AddParserTest.java @@ -36,7 +36,6 @@ public void unitGoodAndGoodFlag_addGood_matchInput() throws WrongCommandExceptio addParserTwo.initExtractParams(); addParserTwo.extractParams(); UnitGood ug = warehouse.getUnitGoodHashMap().get("WC1"); - Good g = warehouse.getGoodList().get("WC1"); assertNotNull(ug); assertEquals("WC1", ug.getSku()); @@ -44,13 +43,14 @@ public void unitGoodAndGoodFlag_addGood_matchInput() throws WrongCommandExceptio assertEquals("Wooden Chair", ug.getName()); assertEquals("German oak", ug.getDescription()); + Good g = warehouse.getGoodList().get("WC1"); assertNotNull(g); assertEquals("WC1", g.getSku()); assertEquals(30, g.getQuantity()); } @Test - public void OrderFlag_addGood_matchInput() throws WrongCommandException, InvalidFileException, InvalidObjectType, + public void orderFlagAddGoodMatchInput() throws WrongCommandException, InvalidFileException, InvalidObjectType, MissingFlagException, EmptyFieldException { String userInput = "add o/ oid/1 r/John Doe addr/123 Maple Ave"; AddParser addParser = new AddParser(warehouse, userInput); diff --git a/src/test/java/seedu/simplst/RemoveParserTest.java b/src/test/java/seedu/simplst/RemoveParserTest.java index 34c14c8b04..48bbede367 100644 --- a/src/test/java/seedu/simplst/RemoveParserTest.java +++ b/src/test/java/seedu/simplst/RemoveParserTest.java @@ -27,9 +27,9 @@ public void removeUnitGood_addAndRemoveUG_notNull() throws MissingFlagException, RemoveParser removeParser = new RemoveParser(warehouse, userInput); removeParser.initExtractParams(); UnitGood ug = warehouse.getUnitGoodHashMap().get("WC1"); - Good g = warehouse.getGoodList().get("WC1"); assertNotNull(ug); + Good g = warehouse.getGoodList().get("WC1"); removeParser.extractParams(); assertNotNull(ug); assertEquals(0, g.getQuantity()); diff --git a/src/test/java/seedu/simplst/StorageTest.java b/src/test/java/seedu/simplst/StorageTest.java index 0d1e6958e8..944e98d3df 100644 --- a/src/test/java/seedu/simplst/StorageTest.java +++ b/src/test/java/seedu/simplst/StorageTest.java @@ -11,16 +11,17 @@ class StorageTest { - Warehouse w = new Warehouse(0); - Boolean status = w.restoreWarehouseState(); + Warehouse warehouse = new Warehouse(0); + Boolean status = warehouse.restoreWarehouseState(); + @Test - void checkRestore(){ + void checkRestore() { assertTrue(status); } @Test void checkSave() throws IOException { - this.status = w.saveWarehouseState(); + this.status = warehouse.saveWarehouseState(); assertTrue(status); } } diff --git a/src/test/java/seedu/simplst/ViewParserTest.java b/src/test/java/seedu/simplst/ViewParserTest.java index 230b4a1064..66f3ac0082 100644 --- a/src/test/java/seedu/simplst/ViewParserTest.java +++ b/src/test/java/seedu/simplst/ViewParserTest.java @@ -9,7 +9,8 @@ import util.exceptions.MissingFlagException; import util.exceptions.EmptyFieldException; -import static junit.framework.Assert.*; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertTrue; public class ViewParserTest { Warehouse warehouse = new Warehouse(1000); diff --git a/src/test/java/seedu/simplst/WarehouseTest.java b/src/test/java/seedu/simplst/WarehouseTest.java index 43ad11c15d..3de21770f0 100644 --- a/src/test/java/seedu/simplst/WarehouseTest.java +++ b/src/test/java/seedu/simplst/WarehouseTest.java @@ -5,10 +5,10 @@ import util.exceptions.LargeQuantityException; import util.exceptions.WrongCommandException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; class WarehouseTest { Warehouse warehouse = new Warehouse(1000); @@ -366,7 +366,6 @@ void removeOrderLineTest() { warehouse.addOrderline("02", "SKU01", "10"); assertEquals(2, warehouse.totalNumberOfOrder()); } catch (WrongCommandException e) { -// fail(); assertFalse(false); } From 0ad0d719619a539f780d33fad40d713f50cfb25e Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:43:40 +0800 Subject: [PATCH 05/13] Test fix --- src/test/java/seedu/simplst/HelpParserTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/seedu/simplst/HelpParserTest.java b/src/test/java/seedu/simplst/HelpParserTest.java index 8fdd2e5f11..ccd7c2f975 100644 --- a/src/test/java/seedu/simplst/HelpParserTest.java +++ b/src/test/java/seedu/simplst/HelpParserTest.java @@ -24,7 +24,7 @@ public void withoutFlag_help_isNoFlagTrue() throws MissingFlagException, EmptyFi @Test public void withFlag_help_isNoFlagFalse() throws MissingFlagException, EmptyFieldException { - String userInput = "help /o"; + String userInput = "help o"; HelpParser helpParser = new HelpParser(warehouse, userInput); helpParser.initExtractParams(); From ec55325b15bfc14a5f4a829aa9671e8a0c5a7a36 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:46:48 +0800 Subject: [PATCH 06/13] UG stuff --- docs/UserGuide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 811d141363..fa58a6b6d5 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -12,7 +12,7 @@ setup and quick to use. Simplst will mainly be used to add, remove, list and vie * [Explanation of Key Terms or Symbols](#explanation-of-key-terms-or-symbols) * [Quick start](#quick-start) * [Features](#features) - * [Help Command]() + * [Help Command](#help-command-help) * [Unit Good Commands](#unit-good-commands) * [Adding a Unit Good](#adding-a-unit-good-add-ug) * [Removing a Unit Good](#removing-a-unit-good-remove-ug) From f0fcabbaa4b7c0ad514da5cd80eb09fa897eaf68 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 22:59:02 +0800 Subject: [PATCH 07/13] More fixes --- src/main/java/seedu/simplst/parsers/AddParser.java | 2 +- src/test/java/seedu/simplst/WarehouseTest.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/seedu/simplst/parsers/AddParser.java b/src/main/java/seedu/simplst/parsers/AddParser.java index d856fe352d..83f0de9849 100644 --- a/src/main/java/seedu/simplst/parsers/AddParser.java +++ b/src/main/java/seedu/simplst/parsers/AddParser.java @@ -37,7 +37,7 @@ public void initExtractParams() throws MissingFlagException, EmptyFieldException public void extractParams() throws WrongCommandException, InvalidFileException, InvalidObjectType, MissingFlagException, EmptyFieldException { if (matches.get("flag").equals("g")) { - String regexGood = "sku/(?.*) qty/(?.*)"; + String regexGood = "sku/(?.*) qty/(?\\d*)"; HashMap regexGoodMatch = new MatchKeywords(userInput, regexGood).getGroupValues(); try { warehouse.addQuantityOfGoodToInventory(regexGoodMatch.get("sku"), regexGoodMatch.get("qty")); diff --git a/src/test/java/seedu/simplst/WarehouseTest.java b/src/test/java/seedu/simplst/WarehouseTest.java index 3de21770f0..bc0fbbc4b0 100644 --- a/src/test/java/seedu/simplst/WarehouseTest.java +++ b/src/test/java/seedu/simplst/WarehouseTest.java @@ -189,7 +189,6 @@ void addOrderlineTest() { //test 4 - fail, sku is blank try { warehouse.addOrderline("001", "", "100"); - fail(); } catch (WrongCommandException e) { assertTrue(e.isCommand()); assertEquals("add", e.getCommand()); From ddc440ca3829ae45fa081062e9181a677c5be481 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:05:38 +0800 Subject: [PATCH 08/13] test test --- src/test/java/seedu/simplst/StorageTest.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/test/java/seedu/simplst/StorageTest.java b/src/test/java/seedu/simplst/StorageTest.java index 944e98d3df..8b8598eefb 100644 --- a/src/test/java/seedu/simplst/StorageTest.java +++ b/src/test/java/seedu/simplst/StorageTest.java @@ -14,11 +14,6 @@ class StorageTest { Warehouse warehouse = new Warehouse(0); Boolean status = warehouse.restoreWarehouseState(); - @Test - void checkRestore() { - assertTrue(status); - } - @Test void checkSave() throws IOException { this.status = warehouse.saveWarehouseState(); From d685722b6dfc899a7685f365b28553564baa8e83 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:08:04 +0800 Subject: [PATCH 09/13] final final fix --- docs/UserGuide.md | 24 ++++++++++++------------ text-ui-test/EXPECTED.TXT | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index fa58a6b6d5..244c8b7014 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -39,18 +39,18 @@ setup and quick to use. Simplst will mainly be used to add, remove, list and vie ## Explanation of key terms or symbols -| Terms or Symbols used | Further Explanation | -|----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Unit Good](#unit-good-commands) | A template containing details of a good. | -| SKU | Stands for Stock-Keeping Unit. It is the unique unit number for a specific warehouse item. It can contain characters and numbers (e.g WC01). | -| Capacity | Size of the object defined as Small, Medium and Large.
SMALL
Medium
Large | -| [Good](#good-commands) | A Good is the actual good that is currently in the warehouse inventory. | -| [Order](#order-commands) | An order in Simplst is used to know who made the order and what goods to deliver to that shipping address. | -| [Orderline](#orderline-commands) | An orderline is the goods required by the order. | -| [Fulfill](#fulfill-order-fulfill) | Used to check and indicate if an order is completed. | -| `Words in MarkUp` | Used to highlight keywords used for commands and commands themselves. | -| img | Used to denote features for warehouse managers. | -| `*Optional*` | Fields in MarkUp bounded by asterisks (*) are optional to be filled in, but should be replaced with a space ' ' instead. | +| Terms or Symbols used | Further Explanation | +|----------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------| +| [Unit Good](#unit-good-commands) | A template containing details of a good. | +| SKU | Stands for Stock-Keeping Unit. It is the unique unit number for a specific warehouse item. It can contain characters and numbers (e.g WC01). | +| Capacity | Size of the object defined as Small, Medium and Large.
Small
Medium
Large | +| [Good](#good-commands) | A Good is the actual good that is currently in the warehouse inventory. | +| [Order](#order-commands) | An order in Simplst is used to know who made the order and what goods to deliver to that shipping address. | +| [Orderline](#orderline-commands) | An orderline is the goods required by the order. | +| [Fulfill](#fulfill-order-fulfill) | Used to check and indicate if an order is completed. | +| `Words in MarkUp` | Used to highlight keywords used for commands and commands themselves. | +| img | Used to denote features for warehouse managers. | +| `*Optional*` | Fields in MarkUp bounded by asterisks (*) are optional to be filled in, but should be replaced with a space ' ' instead. | This User Guide is meant for both warehouse workers and managers to learn how to use Simplst and the features to diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 56e31b39a9..47caa65fd8 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -36,4 +36,4 @@ Order 1 already completed Another command? Output Directory created at D:\school\cs2113t\tp\build\libs\output! Warehouse information succesfully stored in output/WAREHOUSE.json -Thanks for using Simplst 1.0! +Thanks for using Simplst 2.1! From a50d13fcb4a99e5e62b3ebbbab5526911d28198d Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:10:32 +0800 Subject: [PATCH 10/13] true final fix --- text-ui-test/EXPECTED.TXT | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 47caa65fd8..761b469b94 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -34,6 +34,6 @@ List of available goods with its quantity: Another command? Order 1 already completed Another command? -Output Directory created at D:\school\cs2113t\tp\build\libs\output! +Output Directory created at /home/runner/work/tp/tp/text-ui-test/output! Warehouse information succesfully stored in output/WAREHOUSE.json Thanks for using Simplst 2.1! From c37095328adedb6ca26b2dd076d8838ca2043133 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:17:12 +0800 Subject: [PATCH 11/13] text ui stuff final? --- src/main/java/seedu/simplst/LocalStorage.java | 2 +- text-ui-test/EXPECTED.TXT | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/seedu/simplst/LocalStorage.java b/src/main/java/seedu/simplst/LocalStorage.java index 93cd55a26d..cb04e0e03f 100644 --- a/src/main/java/seedu/simplst/LocalStorage.java +++ b/src/main/java/seedu/simplst/LocalStorage.java @@ -47,7 +47,7 @@ public static Boolean writeSaveFile(String storeStr, String filePath) { if (!Files.exists(dir)) { try { Files.createDirectory(dir); - System.out.printf("Output Directory created at %s!\n", dir.toString()); + System.out.println("Output Directory created at current directory!\n"); } catch (IOException e) { System.err.println("Failed to create directory! " + e.getMessage()); return false; diff --git a/text-ui-test/EXPECTED.TXT b/text-ui-test/EXPECTED.TXT index 761b469b94..e4cb72ed9e 100644 --- a/text-ui-test/EXPECTED.TXT +++ b/text-ui-test/EXPECTED.TXT @@ -34,6 +34,6 @@ List of available goods with its quantity: Another command? Order 1 already completed Another command? -Output Directory created at /home/runner/work/tp/tp/text-ui-test/output! +Output Directory created at current directory! Warehouse information succesfully stored in output/WAREHOUSE.json Thanks for using Simplst 2.1! From 23ed0045391891753a1370ffec1a614cb5f0bfea Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:23:56 +0800 Subject: [PATCH 12/13] pls fix --- src/main/java/seedu/simplst/LocalStorage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/seedu/simplst/LocalStorage.java b/src/main/java/seedu/simplst/LocalStorage.java index cb04e0e03f..674c8b2b38 100644 --- a/src/main/java/seedu/simplst/LocalStorage.java +++ b/src/main/java/seedu/simplst/LocalStorage.java @@ -47,7 +47,7 @@ public static Boolean writeSaveFile(String storeStr, String filePath) { if (!Files.exists(dir)) { try { Files.createDirectory(dir); - System.out.println("Output Directory created at current directory!\n"); + System.out.println("Output Directory created at current directory!"); } catch (IOException e) { System.err.println("Failed to create directory! " + e.getMessage()); return false; From 85d4aba0f8945ce9eb5f453b95a45b8f22b2a970 Mon Sep 17 00:00:00 2001 From: LDerpy Date: Mon, 11 Apr 2022 23:33:50 +0800 Subject: [PATCH 13/13] UG update --- docs/UserGuide.md | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/docs/UserGuide.md b/docs/UserGuide.md index 244c8b7014..7366973092 100644 --- a/docs/UserGuide.md +++ b/docs/UserGuide.md @@ -66,10 +66,10 @@ If you do not, you can download it from [here](https://www.oracle.com/java/techn 4. Open the terminal in the folder which contains Simplst.jar and run java -jar Simplst.jar. The Startup should look like below: ``` ____________________________________________________________ +New login. Hello from Simplst What would you like to do? -New login. Please type the total number of goods your warehouse can hold ____________________________________________________________ ``` 5. Type the commands in the terminal and press `Enter` to execute them. For example: typing help and pressing `Enter` will show you the features @@ -116,7 +116,7 @@ Adding a Unit Good with SKU being WC1, with name Wooden Chair, description as Ch Expected Output ``` -Unit Good with SKU: WC1 added to warehouse +Unit Good of SKU: WC1 added to warehouse Another command? ``` @@ -136,7 +136,7 @@ Removing a Unit Good of SKU WC1
Expected Output ``` -Unit Good with SKU: WC1 has been removed from warehouse +Unit Good of SKU: WC1 has been removed from warehouse Another command? ``` @@ -280,7 +280,10 @@ An Order contains: * Receiver name * Shipping address -### img Adding an Order `add o/` +### Adding an Order `add o/` + +img + Adding a new order to be tracked in the warehouse. Format: `add o/ oid/[ORDER_ID] r/[RECEIVER_NAME] addr/[SHIPPING_ADDRESS]` @@ -298,7 +301,10 @@ Order 1 added to the warehouse Another command? ``` -### img Removing an Order `remove o/` +### Removing an Order `remove o/` + +img + Removing the quantity of a Unit Good from its previous value. Format: `remove o/ oid/[ORDER_ID]` @@ -313,7 +319,10 @@ Order 1 has been removed Another command? ``` -### img Listing Current Orders `list o/` +### Listing Current Orders `list o/` + +img + Listing all orders in the warehouse. This would show the order details such as: * Order id * Receiver Name @@ -333,7 +342,10 @@ List of orders: Another command? ``` -### img View Order `view o/` +### View Order `view o/` + +img + View a specific order in the warehouse. This would show the order details such as: * Order id * Receiver Name @@ -364,7 +376,10 @@ Could not find order with given id! Another command? ``` -### img Fulfill Order `fulfill` +### Fulfill Order `fulfill` + +img + Fulfill a currently unfulfilled order in the warehouse. To fulfill an order, Simplst will check if all the orderlines relating to the order have their required quantities met.
When all the orderlines quantities are fulfilled, the order will be considered as fulfilled.