Skip to content

Commit

Permalink
Update dg with edit menu and fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
bertrandong committed Apr 15, 2024
1 parent bbeb026 commit c633df6
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 6 deletions.
20 changes: 14 additions & 6 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ After parsing the `cancel` command, the `LogicManager` will call the `Model#dele

The `Predicate` will then be used to filter the list using `stream()`. The updated `FilteredOrderList` will then be reflected in the GUI.

#### Known Limitations
1. As `StringUtil#containsWordIgnoreCase` searches by entire word, searching for `945` in `94567122` for `Phone` will result in false. This is also consistent in `Email`.

2. Only one `PREFIX` can be chosen to filter by. Future improvements may include searching from more than one `PREFIX`. Example: `find o/19 n/John a/Lorong`.

### Add a product to menu feature

#### Implementation
Expand All @@ -213,7 +218,7 @@ The `DeleteMenuCommand` class which extends the `Command` abstract class will be

![DeleteMenuCommandModelDiagram](images/DeleteMenuSequenceDiagram-Model.png)

After parsing the `menu` command, the `LogicManager` will call the `Model#deleteProduct(id)` which calls `AddressBook#deleteProduct(id)`. The `deleteProduct` of `ProductMenu` will then be called, which deletes a product from the `ArrayList<Product` according to the specified `MENU_ID`.
After parsing the `delete` command with menu prefix, the `LogicManager` will call the `Model#deleteProduct(id)` which calls `AddressBook#deleteProduct(id)`. The `deleteProduct` of `ProductMenu` will then be called, which deletes a product from the `ArrayList<Product` according to the specified `MENU_ID`.

`DeleteCommandParser` will construct the respective command based on the accompanying prefixes:
1. If `PREFIX_MENU`, a `DeleteMenuCommand` will be created.
Expand All @@ -225,6 +230,14 @@ After parsing the `menu` command, the `LogicManager` will call the `Model#delete

Edits a `Product` on the menu. Example: `edit m/1 pn/Pie`. The `edit` command works in a similar way as the `delete` command.

![EditMenuCommandSequenceDiagram](images/EditMenuSequenceDiagram-Logic.png)

The `EditMenuCommand` class which extends the `Command` abstract class will be executed by the `LogicManager` which will update the `Product Menu` in the `Model`.

![EditMenuCommandModelDiagram](images/EditMenuSequenceDiagram-Model.png)

After parsing the `edit` command with menu prefix, the `LogicManager` will call the `Model#editProduct(target, editedProduct)` which calls `AddressBook#editProduct(target, editedProduct)`. The `editProduct` of `ProductMenu` will then be called, which edits the product from the `ArrayList<Product` according to the specified `MENU_ID`.

`EditCommandParser` will construct the respective command based on the accompanying prefixes:
1. If `PREFIX_MENU`, a `EditMenuCommand` will be created.
2. If `PREFIX_CUSTOMER_ID`, a `EditCustomerCommand` will be created.
Expand All @@ -245,11 +258,6 @@ The sequence of events are illustrated by the diagram below, starting with the p
The `StageCommand` class which extends the `Command` abstract class will be executed by the `LogicManager` which will update the `addressBook` in the `Model`.
![StageCommandSequenceDiagram-Model](images/StageCommandSequenceDiagram-Model.png)

### Known Limitations
1. As `StringUtil#containsWordIgnoreCase` searches by entire word, searching for `945` in `94567122` for `Phone` will result in false. This is also consistent in `Email`.

2. Only one `PREFIX` can be chosen to filter by. Future improvements may include searching from more than one `PREFIX`. Example: `find o/19 n/John a/Lorong`.

### Completing Order Feature

#### Implementation
Expand Down
87 changes: 87 additions & 0 deletions docs/diagrams/EditMenuSequenceDiagram-Logic.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Logic LOGIC_COLOR_T1
participant ":LogicManager" as LogicManager LOGIC_COLOR
participant ":AddressBookParser" as AddressBookParser LOGIC_COLOR
participant ":EditCommandParser" as EditCommandParser LOGIC_COLOR
participant ":EditMenuCommandParser" as EditMenuCommandParser LOGIC_COLOR
participant "e:EditMenuCommand" as EditMenuCommand LOGIC_COLOR
participant "r:CommandResult" as CommandResult LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
participant "m:Model" as Model MODEL_COLOR
end box

[-> LogicManager : execute("edit m/1 pn/Pie")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand("edit m/1 pn/Pie")
activate AddressBookParser

create EditCommandParser
AddressBookParser -> EditCommandParser
activate EditCommandParser

EditCommandParser --> AddressBookParser
deactivate EditCommandParser

AddressBookParser -> EditCommandParser : parse("m/1 pn/Pie")
activate EditCommandParser

create EditMenuCommandParser
EditCommandParser -> EditMenuCommandParser
activate EditMenuCommandParser

EditMenuCommandParser --> EditCommandParser
deactivate EditMenuCommandParser

EditCommandParser -> EditMenuCommandParser : parse("m/1 pn/Pie")
activate EditMenuCommandParser

create EditMenuCommand
EditMenuCommandParser -> EditMenuCommand
activate EditMenuCommand

EditMenuCommand --> EditMenuCommandParser :
deactivate EditMenuCommand

EditMenuCommandParser --> EditCommandParser : e
deactivate EditMenuCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
EditMenuCommandParser -[hidden]-> EditCommandParser
destroy EditMenuCommandParser

EditCommandParser --> AddressBookParser : e
deactivate EditCommandParser
'Hidden arrow to position the destroy marker below the end of the activation bar.
EditCommandParser -[hidden]-> AddressBookParser
destroy EditCommandParser

AddressBookParser --> LogicManager : e
deactivate AddressBookParser

LogicManager -> EditMenuCommand : execute(m)
activate EditMenuCommand

EditMenuCommand -> Model : editProduct(target, editedProduct)
activate Model

Model --> EditMenuCommand
deactivate Model

create CommandResult
EditMenuCommand -> CommandResult
activate CommandResult

CommandResult --> EditMenuCommand
deactivate CommandResult

EditMenuCommand --> LogicManager : r
deactivate EditMenuCommand

[<--LogicManager
deactivate LogicManager
@enduml
33 changes: 33 additions & 0 deletions docs/diagrams/EditMenuSequenceDiagram-Model.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@startuml
!include style.puml
skinparam ArrowFontStyle plain

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":AddressBook" as AddressBook MODEL_COLOR
end box

box ProductMenu
participant ":ProductMenu" as ProductMenu
end box

[-> Model : editProduct(target, editedProduct)
activate Model

Model -> AddressBook : editProduct(target, editedProduct)
activate AddressBook

AddressBook -> ProductMenu : editProduct(target, editedProduct)
activate ProductMenu

ProductMenu -> ProductMenu : editProduct(target, editedProduct)
ProductMenu -> AddressBook
deactivate ProductMenu

AddressBook --> Model :
deactivate AddressBook

[<-- Model
deactivate Model

@enduml
Binary file added docs/images/EditMenuSequenceDiagram-Logic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/EditMenuSequenceDiagram-Model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c633df6

Please sign in to comment.