diff --git a/docs/DeveloperGuide.md b/docs/DeveloperGuide.md
index bd2c4f6dfc..00f31d6bfc 100644
--- a/docs/DeveloperGuide.md
+++ b/docs/DeveloperGuide.md
@@ -4,13 +4,14 @@
* [Developer Guide](#developer-guide)
* [**Acknowledgements**](#acknowledgements)
* [**Setting up, getting started**](#setting-up-getting-started)
+ * [**General notes**](#general-notes)
* [**Design**](#design)
* [Architecture](#architecture)
- * [How the Architecture Components Interact with Each Other](#how-the-architecture-components-interact-with-each-other)
- * [Ui Component](#ui-component)
- * [Parser Component](#parser-component)
- * [Storage Component](#storage-component)
- * [Data Component](#data-component)
+ * [How the architecture components interact with each other](#how-the-architecture-components-interact-with-each-other)
+ * [Ui component](#ui-component)
+ * [Parser component](#parser-component)
+ * [Storage component](#storage-component)
+ * [Data component](#data-component)
* [**Feature**](#feature)
* [Add Dish](#add-dish)
* [List Menu](#list-menu)
@@ -21,10 +22,16 @@
* [Delete Dish](#delete-dish)
* [Edit Price](#edit-price)
* [Help](#help)
+ * [**Future Enhancements**](#future-enhancements)
+ * [Create an interface for `Pantry`](#create-an-interface-for-pantry)
+ * [Make `Ui` class singleton](#make-ui-class-singleton)
* [**Product scope**](#product-scope)
* [Target user profile](#target-user-profile)
* [Value proposition](#value-proposition)
+ * [**Requirements**](#requirements)
+ * [Non-functional requirements](#non-functional-requirements)
* [User stories](#user-stories)
+ * [**Glossary**](#glossary)
--------------------------------------------------------------------------------------------------------------
## **Acknowledgements**
@@ -40,7 +47,7 @@ Refer to the guide [_UserGuide_](UserGuide.md).
--------------------------------------------------------------------------------------------------------------------
## **General notes**
-Only relevant attributes/associations/methods will be included in the UML diagram.
+Only relevant attributes/associations/methods will be included in the UML diagram. Some of them are omitted to avoid confusion.
--------------------------------------------------------------------------------------------------------------------
## **Design**
@@ -72,7 +79,7 @@ The bulk of the app’s work is done by the following components:
The Sequence Diagram below shows how the components interact with each other for the scenario where the user issues the command `delete 1`.
![Architecture Encode Data](images/sequence/Architecture_Encode_Data.png)
-*Figure 2: Architecture Encode Sequence Diagram*
+
*Figure 2: Architecture Encode Sequence Diagram*
### Ui component
API: [Ui.java]({repoURL}src/main/java/seedu/cafectrl/ui/Ui.java)
@@ -94,7 +101,7 @@ API: [Parser.java]({repoURL}src/main/java/seedu/cafectrl/parser/Parser.java)
*Figure 4: Parser Class Diagram*
-The `Parser` component is respnsible for making sense of the user's input and return appropriate `Command` for execution. If the input is unrecognisable, `Parser` will return an `IncorrectCommand` which will display error message to the user through `Ui`.
+The `Parser` component is responsible for interpreting the user's input and return appropriate `Command` for execution. If the input is unrecognisable, `Parser` will return an `IncorrectCommand` which will display error message to the user through `Ui`.
**Note:** `CafeCtrl` only have access to the interface `ParserUtil` although the run-time type object is `Parser`. With this, we are able to decrease coupling between `CafeCtrl` and `Parser`, allowing for easier maintenance. This also ensures the testability as we could provide mock or stub dependencies during testing, we could isolate the behavior of the class and focus on unit testing without external dependencies.
@@ -294,6 +301,19 @@ API: [HelpCommand.java]({repoURL}src/main/java/seedu/cafectrl/command/HelpComman
When the `execute()` method of `HelpCommand` is invoked in `Main`, it subsequently calls the `showHelp()` method in `Ui`. In `showHelp()`, messages related to command usage will be retrieved and be printed out using by self-invoking `showToUserWithSpaceInBetweenLines(messages: String...)`.
+--------------------------------------------------------------------------------------------------------------------
+## **Future Enhancements**
+### Create an interface for `Pantry`
+ - **Problem**: `Pantry` class is used in testing of methods such as `addOrder`. With this implementation, we are unable to test the `addOrder` feature in isolation as any bugs in `Pantry` class could potentially affect the behaviour of `addOrder` feature.
+ - **Solution**: Instead of using the concrete `Pantry` class, `addOrder` could use an interface `PantryUtil` to access the required methods. A hard coded class that is less prone to bugs can be used to substitute the actual `Pantry` class by implementing a `PantryUtil` interface.
With this, we are able to test the method in isolation as we have removed the dependency on the actual `Pantry` class.
+### Make `Ui` class singleton
+ - **Problem**: As we need to use the same `Ui` instance for all methods to avoid repeated instantiation of `Scanner` which could slow down the application, the same `Ui` instance is being passed to the constructor for all `Command` classes. This makes the parameters for the constructor looks too long.
+ - **Solution**: Implement a static `getInstance` method in `Ui` class which, when it is called for the first time, creates a new instance of `Ui` and store it in a static constant in the `Ui` object. The method will return the `ui` object in the constant for subsequent `getInstance` call.
With this implementation, we no longer need to pass `ui` around as we can access the same `ui` object by calling `getInstance`.
+
![Class diagram for singleton Ui](images/class/ui_singleton.png)
+
*Figure 17: Class diagram for singleton Ui*
+
![Sequence diagram for singleton Ui](images/sequence/ui_singleton.png)
+
*Figure 18: Sequence diagram for `getinstance` call on `Ui`*
+
--------------------------------------------------------------------------------------------------------------------
## **Product scope**
### Target user profile
@@ -310,24 +330,24 @@ Our product aims to optimize managing of inventory and cash flow in a restaurant
1. This application requires the use of Java 11.
2. This application should work on most mainstream OS.
+3. This application should be able to work offline
### User stories
-| Priority | As a … | I want to … | So that I can… |
-|----------|-----------------------------------------------------------|---------------------------------------------------------|-----------------------------------------------------------------------------------------|
-| `* * *` | cafe owner who is responsible for coming up with new dish | add dish to the menu | add new dish to the menu |
-| `* * *` | cafe manager is responsible for managing pantry stock | track the inventory levels for ingredients and supplies | know what ingredients I need to restock |
-| `* * *` | cafe manager is responsible for managing pantry stock | buy ingredients | restock low stock ingredients |
-| `* * *` | cafe owner who is also the chef | view the ingredients needed for a dish | know what ingredients to use when cooking a dish |
-| `* * *` | cafe owner who wants to maximise profit | edit the price of the dish | increase the price of the dish when there is inflation |
-| `* * *` | cafe owner who cares about the sales of the cafe | view the sales of the cafe | know whether my cafe is profiting |
-| `* * *` | cafe owner who works 7 days a week | save the menu, pantry stock and order | have access to the same menu, pantry stock and orders when I go back to work |
-| `* * *` | cafe owner who is responsible for placing order | add order | ask the chef to cook the order |
-| `* *` | cafe manager who is responsible for drafting the menu | view the menu | keep track of what dish we have |
-| `* *` | cafe owner who working 7 days a week | fast forward to the next day | close the cafe and call it a day when I am tired |
-| `* *` | clumsy cafe owner who works 7 days a week | go back to the previous day | still accept order from the previous day if I accidentally fast forward to the next day |
-
-*{More to be added}*
+| Priority | As a … | I want to … | So that I can… |
+|-------------------------------|-----------------------------------------------------------------------|---------------------------------------------------------|-----------------------------------------------------------------------------------------|
+| `* * *` | cafe owner who is responsible for coming up with new dish | add dish to the menu | add new dish to the menu |
+| `* * *` | cafe manager is responsible for managing pantry stock | track the inventory levels for ingredients and supplies | know what ingredients I need to restock |
+| `* * *` | cafe manager is responsible for managing pantry stock | buy ingredients | restock low stock ingredients |
+| `* * *` | cafe owner who is also the chef | view the ingredients needed for a dish | know what ingredients to use when cooking a dish |
+| `* * *` | cafe owner who wants to maximise profit | edit the price of the dish | increase the price of the dish when there is inflation |
+| `* * *` | cafe owner who cares about the sales of the cafe | view the sales of the cafe | know whether my cafe is profiting |
+| `* * *` | cafe owner who works 7 days a week | save the menu, pantry stock and order | have access to the same menu, pantry stock and orders when I go back to work |
+| `* * *` | cafe owner who is responsible for placing order | add order | ask the chef to cook the order |
+| `* *` | cafe manager who is responsible for drafting the menu | view the menu | keep track of what dish we have |
+| `* *` | cafe owner who working 7 days a week | fast forward to the next day | close the cafe and call it a day when I am tired |
+| `* *` | clumsy cafe owner who works 7 days a week | go back to the previous day | still accept order from the previous day if I accidentally fast forward to the next day |
+| `* *`
(to be implemented) | cafe owner who is interested to know the popularity of the menu items | view the rank of popularity based on order history | adjust the pricing or remove the dish that is not popular |
--------------------------------------------------------------------------------------------------------------------
## **Glossary**
diff --git a/docs/UserGuide.md b/docs/UserGuide.md
index cc66a28451..eb72016aa7 100644
--- a/docs/UserGuide.md
+++ b/docs/UserGuide.md
@@ -4,20 +4,21 @@
* [User Guide](#user-guide)
* [Introduction](#introduction)
* [Quick Start](#quick-start)
+ * [Summary](#summary)
* [Features](#features)
* [Viewing help : `help`](#viewing-help--help)
* [Adding a dish : `add`](#adding-a-dish--add)
- * [Listing all menu items : `list_menu`](#listing-all-menu-items--list_menu)
- * [Listing ingredients needed for the selected dish : `list_ingredients`](#listing-ingredients-needed-for-the-selected-dish--list_ingredients)
- * [Deleting a menu item : `delete`](#deleting-a-menu-item--delete)
- * [Editing price of menu item : `edit_price`](#editing-price-of-menu-item--edit_price)
- * [Viewing the total stock of ingredients : `view_stock`](#viewing-the-total-stock-of-ingredients--view_stock)
- * [Buying an ingredient : `buy_ingredient`](#buying-an-ingredient--buy_ingredient)
- * [Showing all sales : `list_total_sales`](#showing-all-sales--list_total_sales)
- * [Showing sales for a chosen day : `list_sale`](#showing-sales-for-a-chosen-day--list_sale)
- * [Adding an order : `add_order`](#adding-an-order--add_order)
- * [Returning to the previous day: `previous_day`](#returning-to-the-previous-day-previous_day)
- * [Advancing to the next day: `next_day`](#advancing-to-the-next-day-next_day)
+ * [Deleting a dish : `delete`](#deleting-a-dish--delete)
+ * [Editing price of a dish : `edit_price`](#editing-price-of-a-dish--editprice)
+ * [Listing all dishes : `list_menu`](#listing-all-dishes--listmenu)
+ * [Listing ingredients needed for the selected dish : `list_ingredients`](#listing-ingredients-needed-for-the-selected-dish--listingredients)
+ * [Buying an ingredient : `buy_ingredient`](#buying-an-ingredient--buyingredient)
+ * [Viewing the total stock of ingredients : `view_stock`](#viewing-the-total-stock-of-ingredients--viewstock)
+ * [Adding an order : `add_order`](#adding-an-order--addorder)
+ * [Showing total sales : `list_total_sales`](#showing-total-sales--listtotalsales)
+ * [Showing sales for a chosen day : `list_sale`](#showing-sales-for-a-chosen-day--listsale)
+ * [Advancing to the next day: `next_day`](#advancing-to-the-next-day-nextday)
+ * [Returning to the previous day: `previous_day`](#returning-to-the-previous-day-previousday)
* [Exiting the program : `bye`](#exiting-the-program--bye)
* [Known Issues](#known-issues)
* [Command Summary](#command-summary)
@@ -37,12 +38,23 @@ CaféCTRL aims to optimize managing of inventory and cash flow in a restaurant.
4. Open a command terminal, `cd` into the folder you put the jar file in, and use the `java -jar tp.jar` command to run the application.
5. If the setup is correct, you should see something like the below as the output:
```
-Hello! Welcome to CafeCTRL!
------------------------------------------------------
+Hello! Welcome to
+ _/_/_/ _/_/ _/_/_/ _/ _/
+ _/ _/_/_/ _/ _/_/ _/ _/_/_/_/ _/ _/_/ _/
+ _/ _/ _/ _/_/_/_/ _/_/_/_/ _/ _/ _/_/ _/
+_/ _/ _/ _/ _/ _/ _/ _/ _/
+ _/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/_/ _/ _/
+------------------------------------------------------------------------
>
```
+---------------------------------------------------
+
+## Summary
+In CaféCTRL, the user is able to craft and `add dish` to the menu. If needed, he/she can `delete` or `edit` the price of the dish that is already in the menu.
+When there is a new order, the user can `add the order` and prepare it. If there is insufficient stock of ingredients, the user can `buy ingredients`. At the end of the day, the user can check the `sales of the day` or the `total sales` since day one. The user can advance to the `next day` or go back to the `previous day` to take in orders of the day.
---------------------------------------------------
+
## Features
> **Notes about command format:**
> - Words in `UPPER_CASE` are the arguments to be supplied by user.
@@ -58,35 +70,71 @@ Hello! Welcome to CafeCTRL!
> - Extraneous parameters for commands that do not take in parameters (such as `help`, `list_menu`, `bye`) will be ignored.
e.g. if the command specifies `help 123`, it will be interpreted as `help`.
+
### Viewing help : `help`
Shows a message explaining how to use all the commands
Format: `help`
Output:
```
+------------------------------------------------------------------------
These are all the commands I recognise:
-(- Words in UPPER_CASE are the parameters to be supplied by the user.
-e.g. in add name/NAME, NAME is a parameter that can be used as add name/Chicken.
-- Parameters in [] are optional.)
+- Words in UPPER_CASE are the parameters to be supplied by the user.
+ e.g. in add name/NAME, NAME is a parameter that can be used as add name/Chicken.
+- Parameters in [] are optional.
-Command Format:
+------------------------------------------------------------------------
+To add a new dish to the menu:
add name/DISH_NAME price/DISH_PRICE ingredient/INGREDIENT1_NAME qty/INGREDIENT1_QTY[, ingredient/INGREDIENT2_NAME, qty/INGREDIENT2_QTY...]
-(Items in square brackets [] are optional)
-Example:
-add name/chicken rice price/3.00 ingredient/rice qty/200g, ingredient/chicken qty/100g
-
-list_ingredients: Lists out the ingredients needed along with the quantity for a specific dish.
-Parameters: INDEX
-Example: list_ingredients 1
-
-To list out all dishes on the menu: list_menu
-
-To delete a menu item: delete DISH_INDEX
+Example:add name/chicken rice price/3.00 ingredient/rice qty/200g, ingredient/chicken qty/100g
+------------------------------------------------------------------------
+To delete a menu item:
+deleteParameters: INDEX
Example: delete 1
-
-edit_priceTo edit price of a menu item: edit_price dish/DISH_INDEX price/NEW_PRICE
+------------------------------------------------------------------------
+To edit price of a menu item:
+edit_price dish/DISH_INDEX price/NEW_PRICE
Example: edit_price dish/1 price/4.50
+------------------------------------------------------------------------
+To view menu:
+list_menu
+------------------------------------------------------------------------
+To list out the ingredients needed along with the quantity for a specific dish:
+Parameters: index/DISH_INDEX
+Example: list_ingredients index/1
+------------------------------------------------------------------------
+To buy ingredient:
+buy_ingredient ingredient/INGREDIENT1_NAME qty/INGREDIENT1_QTY[, ingredient/INGREDIENT2_NAME, qty/INGREDIENT2_QTY...]
+Example:buy_ingredient ingredient/milk qty/200ml, ingredient/chicken qty/100g
+------------------------------------------------------------------------
+To view pantry stock:
+view_stock
+------------------------------------------------------------------------
+To add a new order:
+add_order name/DISH_NAME qty/QUANTITY
+Example: add_ordername/chicken rice qty/2
+------------------------------------------------------------------------
+To show sales for all days:
+list_total_sales
+------------------------------------------------------------------------
+To show sales for a chosen day:
+list_sale day/DAY_TO_DISPLAY
+Example: list_sale day/1
+------------------------------------------------------------------------
+To travel to next day:
+next_day
+------------------------------------------------------------------------
+To go back to previous day:
+previous_day
+------------------------------------------------------------------------
+To exit:
+bye
+------------------------------------------------------------------------
+To view all commands:
+help
+------------------------------------------------------------------------
+------------------------------------------------------------------------
```
### Adding a dish : `add`
@@ -112,8 +160,42 @@ chicken - 200g
soup - 50ml
```
+
+### Deleting a dish : `delete`
+Deletes a specific dish from the menu
+
+Format: `delete DISH_INDEX`
+
+* Deletes the dish at the specified DISH_INDEX
+* The index refers to the index number shown in the menu list
+* The index must be a positive integer
+
+Example: `delete 1`
+
+Output:
+```
+Okay! chicken rice is deleted! :)
+```
+
+### Editing price of a dish : `edit_price`
+Edits the price of an existing dish on the menu
+
+Format: `edit_price index/DISH_INDEX price/NEW_PRICE`
+
+* `NEW_PRICE` must be a positive number and can have up to 2 decimal places.
+* The index refers to the index number shown in the menu list
+* The index must be a positive integer
+
+Example: `edit_price index/1 price/4.50`
+
+Output:
+```
+Price modified for the following dish:
+Chicken rice - $4.50
+```
+
-### Listing all menu items : `list_menu`
+### Listing all dishes : `list_menu`
Shows a list of all dishes on the menu
Format: `list_menu`
@@ -150,40 +232,24 @@ Example:
+-------------------------------------------------------+
```
-
-### Deleting a menu item : `delete`
-Deletes a specific dish from the menu
-Format: `delete DISH_INDEX`
+### Buying an ingredient : `buy_ingredient`
+Adds one or more ingredients to the pantry
-* Deletes the dish at the specified DISH_INDEX
-* The index refers to the index number shown in the menu list
-* The index must be a positive integer
+Format: `buy_ingredient ingredient/INGREDIENT1_NAME qty/INGREDIENT1_QTY[, ingredient/INGREDIENT2_NAME qty/INGREDIENT2_QTY, ...]`
-Example: `delete 1`
+* `INGREDIENT_QTY` must contain the unit ml or g specifically
+ * e.g. `qty/50g` or `qty/1000ml`
+
+Example: `buy_ingredient ingredient/chicken qty/500g, ingredient/milk qty/1000ml`
Output:
```
-Okay! chicken rice is deleted! :)
+Added to stock:
+Ingredient: chicken Qty: 500g
+Ingredient: milk Qty: 1000ml
```
-
-### Editing price of menu item : `edit_price`
-Edits the price of an existing dish on the menu
-
-Format: `edit_price index/DISH_INDEX price/NEW_PRICE`
-
-* `NEW_PRICE` must be a positive number and can be up to 2 decimal places.
-* The index refers to the index number shown in the menu list
-* The index must be a positive integer
-
-Example: `edit_price index/1 price/4.50`
-
-Output:
-```
-Price modified for the following dish:
-Chicken rice - $4.50
-```
### Viewing the total stock of ingredients : `view_stock`
@@ -205,36 +271,53 @@ Output:
+-------------------------------------------------------+
```
+
+### Adding an order : `add_order`
+Adds an order consisting of dishes off the menu to an order list
-### Buying an ingredient : `buy_ingredient`
-Adds one or more ingredients to the pantry
+Format: `add_order name/DISH_NAME qty/DISH_QTY`
-Format: `buy_ingredient ingredient/INGREDIENT1_NAME qty/INGREDIENT1_QTY[, ingredient/INGREDIENT2_NAME qty/INGREDIENT2_QTY, ...]`
+Example:
+```
+> add_order name/chicken rice qty/2
+I'm busy crafting your selected dish in the virtual kitchen of your dreams. Bon appétit!
+-----------------------------------------------------
+Order is ready!
+Total order cost: $5.00
+-----------------------------------------------------
+Listed below are the availability of the dishes for the next order!
+Dish: chicken rice
+Available Dishes: 8
+-----------------------------------------------------
+Dish: chicken curry
+Available Dishes: 4
+```
+* The `DISH_QTY` must be a positive integer number.
-* `INGREDIENT_QTY` must contain the unit ml or g specifically
- * e.g. `qty/50g` or `qty/1000ml`
+Adds an order to the current business day
-Example: `buy_ingredient ingredient/chicken qty/500g, ingredient/milk qty/1000ml`
+Format: `add_order name/DISH_NAME qty/QUANTITY`
+
+Example: `add_order name/chicken rice qty/2`
Output:
```
-Added to stock:
-Ingredient: chicken Qty: 500g
-Ingredient: milk Qty: 1000ml
+I'm busy crafting your selected dish in the virtual kitchen of your dreams. Bon appétit!
+Is order completed?: true
+Total orderList cost: $4.00
```
-
-### Showing all sales : `list_total_sales`
+### Showing total sales : `list_total_sales`
Displays the dishes sold and total sales for each from Day 1 to the current day that
the cafe is operating on.
-Format: list_total_sales
+Format: `list_total_sales`
Example: `list_total_sales`
Output:
-- show_sales lists the dishes sold along with the total sales for every operating day of the cafe.
+- `show_sales` lists the dishes sold along with the total sales for every operating day of the cafe.
```
+---------------------------------------------------------------------------+
Day 1:
@@ -262,7 +345,6 @@ Day 2:
+---------------------------------------------------------------------------+
```
-
### Showing sales for a chosen day : `list_sale`
Displays the dishes sold along with the total sales for any chosen day.
@@ -285,44 +367,18 @@ Output:
| Total for day: | $12.00 |
+---------------------------------------------------------------------------+
```
+### Advancing to the next day: `next_day`
-
-### Adding an order : `add_order`
-Adds an order consisting of dishes off the menu to an order list
-
-Format: `add_order name/DISH_NAME qty/DISH_QTY`
-
-Example:
-```
-> add_order name/chicken rice qty/2
-I'm busy crafting your selected dish in the virtual kitchen of your dreams. Bon appétit!
------------------------------------------------------
-Order is ready!
-Total order cost: $5.00
------------------------------------------------------
-Listed below are the availability of the dishes for the next order!
-Dish: chicken rice
-Available Dishes: 8
------------------------------------------------------
-Dish: chicken curry
-Available Dishes: 4
-```
-* The `DISH_QTY` must be a positive integer number.
-
-Adds an order to the current business day
-
-Format: `add_order name/DISH_NAME qty/QUANTITY`
+Proceeds to the next business day
-Example: `add_order name/chicken rice qty/2`
+Format: `next_day`
Output:
```
-I'm busy crafting your selected dish in the virtual kitchen of your dreams. Bon appétit!
-Is order completed?: true
-Total orderList cost: $4.00
+Prepare for liftoff! We're about to fast-forward to the next day. Hold onto your hats; here we go!
+Today is Day 2
```
-
### Returning to the previous day: `previous_day`
Goes back to the previous business day
@@ -335,29 +391,18 @@ Sure thing! Let's rev up the virtual DeLorean and take a spin to the previous da
Today is Day 1
```
-### Advancing to the next day: `next_day`
-
-Proceeds to the next business day
-
-Format: `next_day`
-
-Output:
-```
-Prepare for liftoff! We're about to fast-forward to the next day. Hold onto your hats; here we go!
-Today is Day 2
-```
-
### Exiting the program : `bye`
Exits the program.
Format: `bye`
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+
## Known Issues
-- The application is unable to read the data text files if they have been edited directly in the wrong decoding format.
+- The application is unable to decode the data text files if they have been edited in the wrong decoding format.
- The application is unable to detect wrong argument tag, a general incorrect command format will be printed out for wrong argument tag.
-- The application is unable to support unit conversion, hence only ml ang g are accepted as ingredient unit.
+- The application is unable to support unit conversion, hence only ml and g are accepted as ingredient unit and the use of unit must be constant for the same ingredient.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
## Command Summary
@@ -380,6 +425,7 @@ Format: `bye`
| **Exit Program** | `bye` |
---------------------------------------------------
+
## Glossary
- **Dish index**: Index of the dish according to `list_menu`.
-- **stock**: The quantity of ingredient available in the pantry of the cafe.
\ No newline at end of file
+- **Stock**: The quantity of ingredient available in the pantry of the cafe.
\ No newline at end of file
diff --git a/docs/diagrams/class/ui_singleton.puml b/docs/diagrams/class/ui_singleton.puml
new file mode 100644
index 0000000000..3c4c122114
--- /dev/null
+++ b/docs/diagrams/class/ui_singleton.puml
@@ -0,0 +1,10 @@
+@startuml
+'https://plantuml.com/class-diagram
+
+class Ui << singleton >> {
+- {static} theOneUi: Ui
+- scanner: Scanner
+- Ui(): Ui
++ getInstance(): Ui
+}
+@enduml
\ No newline at end of file
diff --git a/docs/diagrams/sequence/ui_singleton.puml b/docs/diagrams/sequence/ui_singleton.puml
new file mode 100644
index 0000000000..08c3436d9d
--- /dev/null
+++ b/docs/diagrams/sequence/ui_singleton.puml
@@ -0,0 +1,17 @@
+@startuml
+'https://plantuml.com/sequence-diagram
+
+autonumber
+participant ":Command" as Command
+participant "Ui" as Ui <>
+
+Command -> Ui: getInstance()
+alt Ui.theOneUi != null
+ return theOneui: Ui
+else
+ Ui -> Ui: Ui()
+ Ui --> Ui: theOneUi: Ui
+ Ui -> Ui: setTheOneUi(theOneUi: Ui)
+ Ui -> Command: theOneUi: Ui
+end
+@enduml
\ No newline at end of file
diff --git a/docs/images/class/ui_singleton.png b/docs/images/class/ui_singleton.png
new file mode 100644
index 0000000000..044c34001e
Binary files /dev/null and b/docs/images/class/ui_singleton.png differ
diff --git a/docs/images/sequence/ui_singleton.png b/docs/images/sequence/ui_singleton.png
new file mode 100644
index 0000000000..99319e7f9b
Binary files /dev/null and b/docs/images/sequence/ui_singleton.png differ
diff --git a/docs/team/ziyi105.md b/docs/team/ziyi105.md
index 3297fdbd23..bbaf0c7d8f 100644
--- a/docs/team/ziyi105.md
+++ b/docs/team/ziyi105.md
@@ -28,9 +28,10 @@ Café proprietors who prefer typing on CLI than any other interaction method and
Command Format: `edit_price dish/DISH_INDEX price/NEW_PRICE`
Error Handling: This command is able to detect missing argument tag, missing argument, wrong argument type, empty argument type and same price. It will then output specific error message to give user hint.
-2. **Help**
- Function: Print out a list of commands and their usages to the user
-
+ 2. **Help**
+ Function: Print out a list of commands and their usages to the user
+ Extra info: This feature requires constant updating whenever a new feature is added. It is also very tedious to implement Junit test as the output is very long and keeps changing. Hence, I removed the Junit test in the last iteration as I feel that it is not necessary to have Junit test for a trivial `help` command.
+
3. **Encoding & Decoding of Pantry Stock Storage File**
Function: When the user calls bye command, all the ingredients stored in pantry will be encoded into format of `INGREDIENT_NAME | QUANTITY | UNIT`. The encoded data will be written in Pantry_stock.txt file. When the user starts a new session, the data in the text file will be extracted out and be decoded to load the ingredients back to PantryStock class.
Error Handling: This command will still check for the validity of each argument (e.g., length of ingredient name, type of unit), and skip the particular ingredient if any of the arguments is not valid. This can prevent the user from accidentally adding invalid ingredients to the text file.
@@ -51,7 +52,7 @@ Café proprietors who prefer typing on CLI than any other interaction method and
[Relevant PR](https://github.com/AY2324S1-CS2113-T17-2/tp/pull/51)
- Learned `Pattern` and `Matcher` API by referring to addressbook and online documentations.
- Created regex `COMMAND_ARGUMENT_FORMAT`, `ADD_ARGUMENT_STRING`, `LIST_INGREDIENT_ARGUMENT_STRING`, `DELETE_ARGUMENT_STRING` and `EDIT_PRICE_ARGUMENT_STRING`.
- - Created a skeleton method body of `prepare_add` method using patter and matcher, and added some basic explanations on how to use them for Dexter to follow and implement the feature.
+ - Created a skeleton method body of `prepare_add` method using pattern and matcher, and added some basic explanations on how to use them for Dexter to follow and implement the feature.
### Contributions to UG
[UserGuide](https://ay2324s1-cs2113-t17-2.github.io/tp/UserGuide.html)
@@ -66,12 +67,16 @@ Café proprietors who prefer typing on CLI than any other interaction method and
3. Known Issues
4. Glossary
5. General formatting
+ - Ensure consistency of features descriptions and table formatting
+ - Correct typos and grammar error
### Contributions to DG
+[DeveloperGuide](https://ay2324s1-cs2113-t17-2.github.io/tp/DeveloperGuide.html)
#### Individual Task
1. Parser component
2. Edit Price
3. Help
+4. Future Enhancements
#### Team-based Task
1. Table of Contents
@@ -81,11 +86,16 @@ Café proprietors who prefer typing on CLI than any other interaction method and
5. Non-Functional Requirements
6. Glossary
7. General formatting
+ - Ensure consistency of features descriptions and diagrams
+ - Correct typos and grammar error
### Other Contributions to Team-based Task
1. Maintaining issue tracker with Dexter by labeling issues
2. Adding theme to UG & DG
3. Approving and merging PRs
+4. Reminding team members to use github effectively (although some of my reminders were ignored :")
+ - I encouraged my team members to report bugs using issue tracker on Github instead of using Telegram. (e.g., [#323](https://github.com/AY2324S1-CS2113-T17-2/tp/issues/323))
+ - I requested PR reviews from my team members as I noticed they haven't had a chance to do any review. (e.g., [PR #51](https://github.com/AY2324S1-CS2113-T17-2/tp/pull/51))
### Review/Mentoring Contributions
1. Reviewed and approved 52 PRs in total.
@@ -103,4 +113,4 @@ Café proprietors who prefer typing on CLI than any other interaction method and
### Contributions beyond the Project Team
1. Posted 8 posts in the forum.
Examples of forum posts: [#37](https://github.com/nus-cs2113-AY2324S1/forum/issues/37), [#19](https://github.com/nus-cs2113-AY2324S1/forum/issues/19), [#31](https://github.com/nus-cs2113-AY2324S1/forum/issues/31)
-2. Reviews on PR from other teams: [T18-1]https://github.com/nus-cs2113-AY2324S1/tp/pull/19#discussion_r1379823357, {will add more in the future}
\ No newline at end of file
+2. Reviews on PR from other teams: [T18-1](https://github.com/nus-cs2113-AY2324S1/tp/pull/19#discussion_r1379823357)
\ No newline at end of file
diff --git a/src/main/java/seedu/cafectrl/command/HelpCommand.java b/src/main/java/seedu/cafectrl/command/HelpCommand.java
index e2cfc3f4b5..6f18624888 100644
--- a/src/main/java/seedu/cafectrl/command/HelpCommand.java
+++ b/src/main/java/seedu/cafectrl/command/HelpCommand.java
@@ -6,6 +6,9 @@
import java.util.logging.Logger;
//@@author ziyi105
+/**
+ * Show a list of commands for users to refer to
+ */
public class HelpCommand extends Command {
public static final String COMMAND_WORD = "help";
public static final String MESSAGE_USAGE = "To view all commands:\n" + COMMAND_WORD;
@@ -18,6 +21,9 @@ public HelpCommand(Ui ui) {
this.ui = ui;
}
+ /**
+ * Call ui to show list of commands
+ */
@Override
public void execute() {
logger.info("Executing HelpCommand...");
diff --git a/src/main/java/seedu/cafectrl/storage/Decoder.java b/src/main/java/seedu/cafectrl/storage/Decoder.java
index a026b5cb87..da71314f65 100644
--- a/src/main/java/seedu/cafectrl/storage/Decoder.java
+++ b/src/main/java/seedu/cafectrl/storage/Decoder.java
@@ -142,6 +142,13 @@ && isValidUnit(unit)) {
return new Pantry(ui, pantryStock);
}
+ /**
+ * Checks whether the ingredient name is valid in terms of length, containment of
+ * special character and whether it is a repeated ingredient
+ * @param ingredientName name of the ingredient
+ * @param pantryStock pantry stock with data from previous lines in the text file
+ * @return true if the name is valid, false otherwise
+ */
private static boolean isValidIngredientName(String ingredientName, ArrayList pantryStock) {
return !Parser.containsSpecialChar(ingredientName)
&& !Parser.isNameLengthInvalid(ingredientName)
diff --git a/src/main/java/seedu/cafectrl/storage/Encoder.java b/src/main/java/seedu/cafectrl/storage/Encoder.java
index ca134a9949..30d44b86ef 100644
--- a/src/main/java/seedu/cafectrl/storage/Encoder.java
+++ b/src/main/java/seedu/cafectrl/storage/Encoder.java
@@ -89,7 +89,7 @@ private static StringBuilder encodeIngredientList(ArrayList ingredie
//@@author ziyi105
/**
- * Encodes the pantry stock into format ingredient name | quantity | unit
+ * Encodes the pantry stock into format ingredient name | quantity | unit for storage
*
* @param pantry the pantry from current session
* @return an arrayList of string of ecoded pantry stock
diff --git a/src/main/java/seedu/cafectrl/ui/Ui.java b/src/main/java/seedu/cafectrl/ui/Ui.java
index fb3b9402c9..e54c858deb 100644
--- a/src/main/java/seedu/cafectrl/ui/Ui.java
+++ b/src/main/java/seedu/cafectrl/ui/Ui.java
@@ -147,8 +147,6 @@ public void showHelp() {
showToUser(Messages.LINE_STRING);
ArrayList usagesTexts = new ArrayList<>();
- usagesTexts.add(ExitCommand.MESSAGE_USAGE);
- usagesTexts.add(HelpCommand.MESSAGE_USAGE);
usagesTexts.add(AddDishCommand.MESSAGE_USAGE);
usagesTexts.add(DeleteDishCommand.MESSAGE_USAGE);
usagesTexts.add(EditPriceCommand.MESSAGE_USAGE);
@@ -161,6 +159,8 @@ public void showHelp() {
usagesTexts.add(ListSaleByDayCommand.MESSAGE_USAGE);
usagesTexts.add(NextDayCommand.MESSAGE_USAGE);
usagesTexts.add(PreviousDayCommand.MESSAGE_USAGE);
+ usagesTexts.add(ExitCommand.MESSAGE_USAGE);
+ usagesTexts.add(HelpCommand.MESSAGE_USAGE);
showToUserWithSpaceBetweenLines(usagesTexts);
}
diff --git a/src/test/java/seedu/cafectrl/parser/ParserTest.java b/src/test/java/seedu/cafectrl/parser/ParserTest.java
index 00f94a27de..ff009569b6 100644
--- a/src/test/java/seedu/cafectrl/parser/ParserTest.java
+++ b/src/test/java/seedu/cafectrl/parser/ParserTest.java
@@ -193,6 +193,7 @@ public void parseCommand_deleteIndexOutOfBounds_returnsErrorMessage() {
assertEquals(ErrorMessages.INVALID_DISH_INDEX, feedbackToUser);
}
+ //@@author ziyi105
@Test
void parseCommand_unrecognisedInput_unknownCommand() {
Menu menu = new Menu();
diff --git a/src/test/java/seedu/cafectrl/storage/DecoderTest.java b/src/test/java/seedu/cafectrl/storage/DecoderTest.java
index 04296071a1..43d2deb425 100644
--- a/src/test/java/seedu/cafectrl/storage/DecoderTest.java
+++ b/src/test/java/seedu/cafectrl/storage/DecoderTest.java
@@ -9,6 +9,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
+//@@author ziyi105
public class DecoderTest {
@Test
void decodePantryStockData_validData_pantryFilledWithStock() {