Skip to content

Commit

Permalink
Merge pull request #133 from guanquann/branch-addorder-dg
Browse files Browse the repository at this point in the history
Update addorder sequence diagram, use case and manual testing
  • Loading branch information
guanquann authored Apr 11, 2024
2 parents 5ae03e0 + 3f83933 commit b2903e6
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 51 deletions.
89 changes: 65 additions & 24 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ The `addfav` feature allows users to add suppliers as favourites.

**Aspect: How a contact being set as favourite is represented:**

- **Alternative 1 (current choice):** A boolean field in the `Person` class is used to indicate whether a `Person` is a favourite
- **Alternative 1 (current choice):** A boolean field in the `Person` class is used to indicate whether a `Person` is a favourite
- Pros: Make use of the current `Person` class by adding a simple primitive boolean to store information about favourites.
- Cons: Not a uniform way of representing information in the `Person` class given that all other fields are their own defined classes.

Expand Down Expand Up @@ -215,7 +215,7 @@ The `showfav` feature allows users to filter the contacts such that only the fav
**Aspect: How the end result of filtering manifests:**

- **Alternative 1 (current choice):** The filtering logic follows closely from that of the `find` feature.
- Pros: Simple and easy to implement given the existing `find` feature.
- Pros: Simple and easy to implement given the existing `find` feature.
- Cons: May result in some similar functionality between `find` and `showfav` features.

- **Alternative 2:** Favourite contacts can be sorted to be above, with non-favourites below but still visible.
Expand All @@ -230,7 +230,7 @@ Below is the sequence diagram for the `showfav` command process:

### Add order feature

The `addorder` feature allows users to add orders from a supplier.
The `addorder` feature allows users to add orders to a contact.

#### Design considerations:

Expand All @@ -250,7 +250,7 @@ Below is the sequence diagram for the `addorder` command process:

<puml src="diagrams/AddOrderSequenceDiagram.puml" alt="AddOrderSequenceDiagram" />

### ListOrder Feature
### List order Feature

The `listorder` feature allows users to list all orders associated with a person in the address book, sorted by date in ascending order first, then sorted by order they were added in if date is the same. This is particularly useful for users who wish to track the order history of suppliers efficiently.

Expand Down Expand Up @@ -278,14 +278,14 @@ Below is the sequence diagram for the `listorder` command process:
- **Sorting by Status:** Introduce functionality to sort orders by their status (e.g., pending, completed), providing users with more flexibility in viewing order information.
- **Filtering Options:** Implement filters to allow users to view orders within a specific date range or with particular characteristics, such as orders over a certain value.

### DeleteOrder Feature
### Delete order Feature

The `deleteorder` feature allows users to delete a specific order from a supplier's list of orders, ensuring accurate and up-to-date record-keeping.

#### Design Considerations

- **Aspect: How order deletion is managed within Person objects**:
-

- **Alternative 1 (current choice):** Directly manage orders within the Person class by removing them from the person's orders list.
- Pros: Utilizes the existing structure of the Person class, allowing for straightforward access and modification of a person's order list.
- Cons: Adds complexity to the Person class, which now handles both personal information and order management.
Expand Down Expand Up @@ -462,16 +462,16 @@ _{More to be added}_

### Use cases

(For all use cases below, the **System** is the `AddressBook` and the **Actor** is the `user`, unless specified otherwise)
(For all use cases below, the **System** is the `GourmetGrid` and the **Actor** is the `user`, unless specified otherwise)

**Use case: Delete a person**

**MSS**

1. User requests to list persons
2. AddressBook shows a list of persons
3. User requests to delete a specific person in the list
4. AddressBook deletes the person
1. User requests to list contacts
2. System shows a list of contacts
3. User requests to delete a specific contact in the list
4. System deletes the contact

Use case ends.

Expand All @@ -481,13 +481,34 @@ _{More to be added}_

Use case ends.

- 3a. The given index is invalid.
- 3a. System detects that the contact does not exist.

- 3a1. AddressBook shows an error message.
- 3a1. System shows an error message.

Use case resumes at step 2.
Use case ends.

_{More to be added}_
---

**Use case: Add an order**

**MSS**

1. User requests to add an order to a contact
2. System adds the order to the contact

Use case ends.

**Extensions**

- 1a. System detects an error in the user command.
- 1a1. System shows an error message.

Use case ends.

- 1b. System detects that the contact does not exist.
- 1b1. System shows an error message.

Use case ends.

### Non-Functional Requirements

Expand Down Expand Up @@ -552,7 +573,27 @@ testers are expected to do more _exploratory_ testing.
1. Other incorrect delete commands to try: `delete`, `delete x`, `...` (where x is larger than the list size)<br>
Expected: Similar to previous.

1. _{ more test cases …​ }_
### Adding an order

1. Adding an order to a person

1. Prerequisites: List all persons using the list command. There is only 1 contact in the address book.

2. Test case: `addorder 1 d/ 2025-01-01 r/ 100 chicken wings`<br>
Expected: The number of orders of the first contact increases by 1. Details of the contact, with the new order, are shown in the status bar. The date of the new order is 2025-01-01 and the remark is 100 chicken wings.

3. Test case: `addorder 0 d/ 2025-01-01 r/ 100 chicken wings`<br>
Expected: No new order is added. An error indicating invalid command format is shown in the status bar.

4. Test case: `addorder 5 d/ 2025-01-01 r/ 100 chicken wings`<br>
Expected: No new order is added. An error indicating invalid person index is shown in the status bar.

5. Test case: `addorder 1 d/ 2025-99-99 r/ 100 chicken wings`<br>
Expected: No new order is added. An error indicating invalid date format is shown in the status bar.

2. Viewing orders after adding order to a contact.

1. To view the orders of the first contact after adding an order, use the `listorder 1` command.

### Saving data

Expand All @@ -568,18 +609,18 @@ testers are expected to do more _exploratory_ testing.

Team size: 4

1. **UI improvements:** The current UI shows the orders of a contact in`StatusBarFooter` when `listorder`
1. **UI improvements:** The current UI shows the orders of a contact in`StatusBarFooter` when `listorder`
command is called. We plan to add an `OrderListPanel` beside the existing `PersonListPanel` to show the orders
of a contact instead. This will allow users to view the orders of a contact in a more user-friendly manner,
of a contact instead. This will allow users to view the orders of a contact in a more user-friendly manner,
without having the need to call `listorder` repeatedly for the same contact whenever a new command updates `StatusBarFooter`.
Furthermore, when a very long field is added, the UI text may be truncated. We plan to add a tooltip to show
Furthermore, when a very long field is added, the UI text may be truncated. We plan to add a tooltip to show
the full text when the mouse hovers over the truncated text.

2. **Make `addorder` message more specific:** The current `addorder` command does not show a preview of the
order added, making it inconvenient for users as they have to scroll all the way to end of `StatusBarFooter`
to view their newly added order. We plan to show a preview of the order added. For example:
2. **Make `addorder` message more specific:** The current `addorder` command does not show a preview of the
order added, making it inconvenient for users as they have to scroll all the way to end of `StatusBarFooter`
to view their newly added order. We plan to show a preview of the order added. For example:
`Added Order: [100 oranges (by: 2024-04-15)] from Alex Yeoh`.

3. **Raise error when an outdated order date is added:** The current date validation does not check if the
order date is outdated when `addorder` command is called. We plan to raise an error when an outdated order date
3. **Raise error when an outdated order date is added:** The current date validation does not check if the
order date is outdated when `addorder` command is called. We plan to raise an error when an outdated order date
is added. For example: `Order date cannot be in the past`.
36 changes: 18 additions & 18 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ This user guide provides in-depth documentation on GourmetGrid installation proc

* `list` : Lists all contacts.

* `add n/James Lim p/98765432 e/[email protected] a/West Street #01-01 c/The Big Butcher` :
* `add n/James Lim p/98765432 e/[email protected] a/West Street #01-01 c/The Big Butcher` :
Adds a contact named `James Lim` with the corresponding details to the contact list.

* `delete 3` : Deletes the 3rd contact shown in the current list.
Expand Down Expand Up @@ -193,7 +193,7 @@ Examples:
- `addfav i/` returns an error message as the 'INDICES' field cannot be empty
- `addfav` returns an error message as it must be accompanied by the 'INDICES' field
- `addfav 1 i/ 2, 5` returns an error message as there should not be prefixes before the 'INDICES' field
-

### Showing favourite contacts : `showfav`

- Shows the contacts that are marked as favourites
Expand All @@ -213,7 +213,7 @@ Examples:
- Removes the contacts specified by index as favourites

Format: `removefav i/INDICES`
- Removes the contacts at the specified `INDICES` from favourites. The indices refer to comma-separated index numbers (i.e. index, index, index) shown in the displayed person list. Each index **must be a positive integer** 1,2,3, ...
- Removes the contacts at the specified `INDICES` from favourites. The indices refer to comma-separated index numbers (i.e. index, index, index) shown in the displayed person list. Each index **must be a positive integer** 1,2,3, ...

<box type="tip" seamless>

Expand Down Expand Up @@ -410,20 +410,20 @@ Furthermore, certain edits can cause GourmetGrid to behave in unexpected ways (e

## Command summary

| Action | Format, Examples |
|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Action | Format, Examples |
|----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| **Add** | `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS c/COMPANY [t/TAG]…​` <br> e.g., `add n/James Ho p/22224444 e/[email protected] a/123, Clementi Rd, 1234665 c/Freshest Farm t/friend t/colleague` |
| **Clear** | `clear` |
| **Delete** | `delete INDEX`<br> e.g., `delete 3` |
| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COMPANY] [t/TAG]…​`<br> e.g.,`edit 2 n/James Lee e/[email protected]` |
| **Find** | `find KEYWORD/ [KEYWORD]`<br> e.g., `find n/ James n/ T t/ friend t/ rich` |
| **Add Order** | `addorder INDEX d/DATE r/REMARK`<br> e.g., `addorder 1 d/ 2020-01-01 r/ 100 chicken wings` |
| **List Orders** | `listorder INDEX` |
| **Delete Order** | `deleteorder INDEX o/ORDER_INDEX`<br> e.g., `deleteorder 2 o/1` |
| **Add Favourite** | `addfav i/INDICES`<br> e.g., `addfav i/1,2` |
| **Show Favourites** | `showfav` |
| **Remove Favourite** | `removefav i/INDICES`<br> e.g., `removefav i/2` |
| **List** | `list` |
| **Help** | `help` |
| **Exit** | `exit` |
| **Clear** | `clear` |
| **Delete** | `delete INDEX`<br> e.g., `delete 3` |
| **Edit** | `edit INDEX [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COMPANY] [t/TAG]…​`<br> e.g.,`edit 2 n/James Lee e/[email protected]` |
| **Find** | `find KEYWORD/ [KEYWORD]`<br> e.g., `find n/ James n/ T t/ friend t/ rich` |
| **Add Order** | `addorder INDEX d/DATE r/REMARK`<br> e.g., `addorder 1 d/ 2020-01-01 r/ 100 chicken wings` |
| **List Orders** | `listorder INDEX` |
| **Delete Order** | `deleteorder INDEX o/ORDER_INDEX`<br> e.g., `deleteorder 2 o/1` |
| **Add Favourite** | `addfav i/INDICES`<br> e.g., `addfav i/1,2` |
| **Show Favourites** | `showfav` |
| **Remove Favourite** | `removefav i/INDICES`<br> e.g., `removefav i/2` |
| **List** | `list` |
| **Help** | `help` |
| **Exit** | `exit` |

14 changes: 5 additions & 9 deletions docs/diagrams/AddOrderSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ box Order ORDER_COLOR_T1
participant ":Order" as Order ORDER_COLOR
end box

box Person PERSON_COLOR_T1
participant "p:Person" as Person PERSON_COLOR
end box

box Model MODEL_COLOR_T1
participant "m:Model" as Model MODEL_COLOR
end box
Expand Down Expand Up @@ -64,13 +60,13 @@ deactivate AddressBookParser
LogicManager -> AddOrderCommand : execute(m)
activate AddOrderCommand

AddOrderCommand --> Person : addOrder(order)
activate Person
AddOrderCommand -> Model : getFilteredPersonList()
activate Model

Person --> AddOrderCommand :
deactivate Person
Model --> AddOrderCommand : lastShownList
deactivate Model

AddOrderCommand --> Model : setPerson(p)
AddOrderCommand --> Model : addOrder(person, order)
activate Model

Model --> AddOrderCommand :
Expand Down

0 comments on commit b2903e6

Please sign in to comment.