You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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
+
103
120
### Storage component
104
121
105
122

@@ -288,6 +305,44 @@ instances to accommodate the changes. We do not choose this design as it is very
288
305
unlikely a user would want to modify a completed `Order`, and the user can always
289
306
add a new `Order` instance in the worst case.
290
307
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
+

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.
0 commit comments