Skip to content

Commit 9b488c9

Browse files
committed
Add how labedit is implemented
1 parent 724501d commit 9b488c9

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

docs/DeveloperGuide.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ The following **UML activity diagram** shows what happens when a user executes a
217217

218218
<img src="images/AddLabCommandActivityDiagram.png" width="600" />
219219

220+
220221
### Filter Feature
221222

222223
#### Proposed Implementation
@@ -230,6 +231,52 @@ Given below is an example usage scenario and how the filter mechanism behaves at
230231
Step 1. The user executes `filter l/1 s/s` command.
231232

232233

234+
### `labedit`: Edit Lab Feature
235+
236+
#### Implementation
237+
The `labedit` feature allows for editing of the `LabStatus` and/or `LabMark` of a specified `Lab` in the TAddressBook.<br>
238+
The format of this command is `labedit INDEX l/LAB_NUMBER (s/LAB_STATUS) (m/LAB_MARK)`, where:
239+
* `INDEX` corresponds to the index number of a student, according to the currently displayed student list
240+
* `LAB_NUMBER` corresponds to an existing lab in the TAddressBook
241+
* `LAB_STATUS` is either `u`/`s`/`g` (`UNSUBMITTED`/`SUBMITTED`/`GRADED`)
242+
* `LAB_MARK` is an integer from 0 to 100 inclusive
243+
* The parentheses indicate that at least one of `s/LAB_STATUS` and `m/LAB_MARK` must be provided
244+
245+
The implementation of `labedit` is as follows:
246+
1. When `AddressBookParser#parseCommand` detects `labedit` as the command word, it creates a new `EditLabCommandParser` with the given arguments.
247+
2. `EditLabCommandParser` parses the parameters and throws a `ParseException` if any invalid values are encountered.
248+
3. `EditLabCommand#execute(Model)` will then execute with the current `Model` in the system.
249+
4. The `EditLabCommand` object checks if the given `INDEX` is out of bounds.
250+
5. The `EditLabCommand` object checks if the given combination of `LAB_STATUS` and `LAB_MARK` is valid.
251+
252+
<div markdown="span" class="alert alert-info">:information_source: **Note:** The valid combinations are:
253+
* `LAB_STATUS` and no `LAB_MARK`
254+
* `LAB_MARK` and no `LAB_STATUS`
255+
* `LAB_MARK` and `LAB_STATUS` of `GRADED`
256+
</div>
257+
258+
6. The `EditLabCommand` calls `LabList#setLab` of the student specified by the given `INDEX`, which edits the target `Lab` to the new `Lab`.
259+
260+
The following sequence diagram shows the interactions between components during the execution of the `labedit` command:
261+
262+
<img src="images/EditLabCommandSequenceDiagram.png" width="850" />
263+
264+
<div markdown="span" class="alert alert-info">:information_source: **Note:** In the sequence diagram, the details of `LabList#setLab` have been intentionally omitted. They can be found in the sequence diagram below.
265+
</div>
266+
267+
The following sequence diagram shows how `LabList#setLab` is implemented:
268+
269+
<img src="images/LabListSetLabSequenceDiagram.png" width="550" />
270+
271+
The detailed steps are as follows:
272+
1. `LabList#setLab` checks if the edited `Lab` is the same as the original `Lab`, and whether the target `Lab` exists in the `LabList`.
273+
2. `LabList#setLab` edits the target `Lab` to the new `Lab` with different `LabStatus` and/or `LabMark`.
274+
275+
To summarize, the following activity diagram summarizes what happens when the user requests to edit a lab:
276+
277+
<img src="images/EditLabCommandActivityDiagram.png" width="600" />
278+
279+
233280
### \[Proposed\] Undo/redo feature
234281

235282
#### Proposed Implementation

docs/UserGuide.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ Example:
205205
#### View student details : `view`
206206
View a student's details from the TAddressBook. This includes their personal information (i.e. email, GitHub username, etc.)
207207
as well as the status and/or marks achieved for their labs. A sample result is shown below.<br>
208-
![viewUi](images/viewUI.png)
208+
209+
<img src="images/viewUI.png" width="420" />
209210

210211
Format: `view INDEX`
211212

0 commit comments

Comments
 (0)