Skip to content

Commit 6e25d26

Browse files
authored
Merge pull request #52 from AhQuanz/update-docs
Update DG Design section and Implementation for done command
2 parents 65dce78 + 10f3add commit 6e25d26

8 files changed

Lines changed: 72 additions & 4 deletions

File tree

docs/DeveloperGuide.md

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,23 @@ for the `execute("deletecheese 1")` API call.
100100

101101
### Model component
102102

103+
![Structure of the Model Component](images/ModelClassDiagram.png)
104+
105+
![Structure of the Customer Component](images/CustomerClassDiagram.png)
106+
107+
![Structure of the Cheese Component](images/CheeseClassDiagram.png)
108+
109+
![Structure of the Order Component](images/OrderClassDiagram.png)
110+
111+
**API** : [`Model.java`](https://github.com/AY2021S2-CS2103-W16-2/tp/blob/master/src/main/java/seedu/address/model/Model.java)
112+
113+
The `Model`,
114+
* stores a `UserPref` object that represents the user`s preferences.
115+
* stores the address book data.
116+
* exposes an unmodifiable `ObservableList<Customer>`, `ObservableList<Order>`,`ObservableList<Cheese>` that can be 'observed'.
117+
e.g. the Ui can be bound to this list so that the UI automatically updates when the data in the list change.
118+
* does not depend on any of the other three components.
119+
103120
### Storage component
104121

105122
![Structure of the Storage Component](images/StorageClassDiagram.png)
@@ -288,6 +305,44 @@ instances to accommodate the changes. We do not choose this design as it is very
288305
unlikely a user would want to modify a completed `Order`, and the user can always
289306
add a new `Order` instance in the worst case.
290307

308+
### Mark an order as complete feature
309+
310+
#### implementation
311+
312+
Marking an order as completed is implemented in [`DoneCommand.java`](https://github.com/AY2021S2-CS2103-W16-2/tp/blob/master/src/main/java/seedu/address/logic/commands/DoneCommand.java).
313+
314+
`DoneCommand` extends from `command` and overwrites the operations `execute()` and `equals()`.
315+
316+
Given below is an example usage scenario and how the feature of marking an order as complete feature behaves at each step.
317+
318+
Step 1. The user launches CHIM which will restore archived customers , orders and cheeses.
319+
320+
Step 2. The user issues the command `done 1` to mark the first order shown in the `listorders` as completed.
321+
The `done` command calls `DoneCommand.execute()` which will check the index given is valid and order selected is not completed yet.
322+
323+
Step 3. After initial checks are completed, `DoneCommand.execute()` will call on `ModelManager.getUnassignedCheeses()`
324+
to retrieve unAssigned Cheese(s) required for the order.
325+
326+
Step 4. `DoneCommand.execute()` will call `DoneCommand.createDoneOrder()` to create a new `order`
327+
if there is enough unassigned Cheese(s) from `ModelManager.getUnassignedCheeses()`.
328+
329+
Step 5. `DoneCommand.execute()` will call `ModelManager.setOrder()`
330+
to replace the original order with the new order created from `DoneCommand.createDoneOrder()`
331+
and calls `ModelManager.updateCheesesStatus()` to update all cheese(s)'s assign status used for this order.
332+
333+
The following sequence diagram shows how the operation `done 1` is carried out as detailed above.
334+
335+
![Sequence Diagram of the Done Command](images/DoneCommandSeqDiagram.png)
336+
337+
#### Design consideration
338+
* Aspect : Searching for available cheese(s) for the order.
339+
* Current choice : Searching for unassigned cheeses for the order is implemented in the `Model.AddressBook`.
340+
* Pros: no dependency between `Done` command and `Cheese`.
341+
* Cons: performance issues due to multiple functions calls.
342+
* Alternative 1 : `Done` command will search for unassigned cheeses.
343+
* Pros: better in terms of performance as there are lesser functions to be called.
344+
* Cons: This introduces another reason for 'DoneCommand.execute()' to change in the future.
345+
291346
## **Documentation, logging, testing, configuration, dev-ops** [In Progress]
292347

293348
--------------------------------------------------------------------------------------------------------------------
@@ -574,7 +629,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
574629

575630
**MSS**
576631
1. User enters the index of the order to be marked as complete.
577-
1. CHIM assigns avaliable cheeses to the order and marks the order as complete.
632+
1. CHIM assigns available cheeses to the order and marks the order as complete.
578633

579634
Use case ends.
580635

@@ -653,6 +708,14 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
653708
Use case ends.
654709

655710

711+
#### Use case: Clear all data
712+
713+
**MSS**
714+
1. User enters the command to clear all data.
715+
2. CHIM clears customer , orders and cheese data and informs the user.
716+
717+
Use case ends.
718+
656719
#### Use case: Exit the application
657720

658721
**MSS**

docs/UserGuide.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ Format: `deletecustomer p/PHONE_NUMBER`
137137

138138
Example: `deletecustomer p/65555555`
139139

140-
141140
### Listing orders: `listorders`
142141

143142
Displays all orders in CHIM.
@@ -150,7 +149,6 @@ Displays all cheeses in CHIM.
150149

151150
Format: `listcheeses`
152151

153-
154152
### Listing customers: `listcustomers`
155153

156154
Displays the customers in CHIM.
@@ -206,6 +204,12 @@ Examples:
206204
* `findorder n/Alice s/incomplete`
207205
* `findorder p/92280919`
208206

207+
### Clearing all data in CHIM: `clear`
208+
209+
Clears all data in CHIM and save files
210+
211+
Format: `clear`
212+
209213
### Exiting the program: `exit`
210214

211215
Exits the program.
@@ -242,4 +246,5 @@ Action | Format, Examples
242246
**Find Customer** | `findcustomer [n/NAME_KEYWORDS...] [p/PHONE_KEYWORDS...] [e/EMAIL_KEYWORDS...] [a/ADDRESS_KEYWORDS...]` <br> e.g. `findcustomer n/Betty`
243247
**Find Cheese** | `findcheese [t/CHEESE_TYPE_KEYWORDS...] [s/ASSIGNMENT_STATUS]` <br> e.g. `findcheese t/Brie Feta s/unassigned`
244248
**Find Order** | `findorder [t/CHEESE_TYPE_KEYWORDS...] [n/CUSTOMER_NAME_KEYWORDS] [p/CUSTOMER_PHONE_KEYWORDS] [s/COMPLETION_STATUS]` <br> e.g. `findorder t/gouda s/complete`
249+
**Clear** | `clear`
245250
**Exit** | `exit`

docs/images/CheeseClassDiagram.png

34.9 KB
Loading
32.4 KB
Loading
41.4 KB
Loading

docs/images/ModelClassDiagram.png

1.04 KB
Loading

docs/images/OrderClassDiagram.png

41.5 KB
Loading

src/main/java/seedu/address/logic/commands/ClearCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
public class ClearCommand extends Command {
1212

1313
public static final String COMMAND_WORD = "clear";
14-
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";
14+
public static final String MESSAGE_SUCCESS = "All data in saved file and CHIM has been cleared!";
1515

1616

1717
@Override

0 commit comments

Comments
 (0)