Skip to content

Commit

Permalink
Merge pull request #190 from sheryew/UG-MORE-TESTS
Browse files Browse the repository at this point in the history
Updated UG and DG.
  • Loading branch information
nixonwidjaja authored Nov 10, 2023
2 parents 502f432 + a424b0d commit e34849d
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 15 deletions.
5 changes: 3 additions & 2 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ If the current `index` is at `AddressBookList.size() - 1`, `AddressBookList` wil
`AddressBookList` sits in `ModelManager` class where it will be modifed whenever `ModelManager#addPerson()`, `ModelManager#deletePerson()`, and `ModelManager#setPerson()`
are called, i.e., whenever `AddressBook` is changed. `ModelManager#undo()` will call `AddressBookList#undo()` and `ModelManager#redo()` will call `AddressBookList#redo()`.

![UndoSequenceDiagram](images/UndoSequenceDiagram.png)

![RedoSequenceDiagram](images/RedoSequenceDiagram.png)

#### Design Considerations

Expand All @@ -197,8 +200,6 @@ are called, i.e., whenever `AddressBook` is changed. `ModelManager#undo()` will
* Pros: Less memory.
* Cons: More complications on the logic side: undoing `add` = `delete`, undoing `clear` = `add` back all employees, etc.



### Export Data Feature

#### Implementation
Expand Down
17 changes: 15 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Examples:

- `add n/Adam p/12345678 e/[email protected] a/Singapore s/10000 b/5000 d/Engineering dob/2000-01-01`
- `add n/John Doe p/87654321 e/[email protected] a/Tokyo s/5000 b/2000 d/Sales dob/1992-07-21`
- `add n/Tharman Shanmugaratnam p/98723459 e/[email protected] a/Istana, Singapore s/10000 b/10000 d/President dob/1957-02-25`

Executing command: `add n/Adam p/12345678 e/[email protected] a/Singapore s/10000 b/5000 d/Engineering dob/2000-01-01`

Expand All @@ -144,6 +145,7 @@ Examples:

- `list` Lists all employees in the employee list.
- `list d/Engineering` Lists all employees in the Engineering department.
- `list d/Sales` Lists all employees in the Sales department.

Executing command: `list d/Engineering`

Expand All @@ -165,6 +167,7 @@ Examples:

- `list` followed by `delete 2` deletes the 2nd person in the employee list.
- `find Betsy` followed by `delete 1` deletes the 1st person in the results of the `find` command.
- `list d/Engineering` followed by `delete 1` deletes the 1st person in the employee list.

Executing command: `delete 1`

Expand All @@ -188,7 +191,8 @@ Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [s/SALARY] [d/DEPAR
Examples:

- `edit 1 p/23423423 e/[email protected]` Edits the phone number and email address of the 1st person to be `23423423` and `[email protected]` respectively.
- `edit 1 n/thomas S/O anthony` Edits the name of the 1st person to be `thomas S/O anthony`.
- `edit 1 n/thomas S/O anthony a/Serangoon` Edits the name and address of the 1st person to be `thomas S/O anthony` and `Serangoon` respectively.
- `edit 2 s/1000 d/Sales dob/2000-01-01` Edits the salary, department and DOB of the 2nd person to be `$1000`, `Sales` and `1 January 2000` respectively.

Executing command: `edit 1 p/23423423 e/[email protected]`

Expand All @@ -213,6 +217,7 @@ Examples:

- `find John` returns `john` and `John Doe`
- `find alex david` returns `Alex Yeoh`, `David Li`<br>
- `find Bernice` returns `bernice`.

Executing command: `find Bernice`

Expand Down Expand Up @@ -246,6 +251,7 @@ Examples:

- `list` followed by `claim 1 $/-500` deducts $50 from employee 1's claim budget.
- `list` followed by `claim 2 $/+60` allocates additional $60 to employee 2's claim budget.
- `list` followed by `claim 3 $-1000` deducts $1000 from employee 3's claim budget.

Executing command: `claim 1 $/-500`

Expand All @@ -267,6 +273,7 @@ Format: `leave INDEX m/MONTHS`
Examples:
- `list` followed by `leave 1 m/3,4` adds leaves in March and April for the 1st employee in the list.
- `list` followed by `leave 3 m/11,-12` adds a leave in Nov and removes a leave in Dec for the 3rd employee in the list.
- `list` followed by `leave 2 m/3` adds a leave in March for the 2nd employee in the list.

Executing command: `leave 1 m/1,3`

Expand Down Expand Up @@ -339,7 +346,9 @@ Format: `view [n/INDEX] [a/INDEX] [e/INDEX] [p/INDEX] [s/INDEX] [b/INDEX] [d/IN
- INDEX parameters can either be a single digit or digits separated by ",".

Examples:
- `view` followed by `s/1,2` displays employees with list's index of 1 and 2 respective salaries.
- `view s/1,2` displays the 1st and 2nd employee respective salaries.
- `view a/3,4` displays the 3rd and 4th employee respective addresses.
- `view dob/1,5` displays the 1st and 5th employee respective DOB.

Executing command: `view p/1,5`

Expand All @@ -357,6 +366,7 @@ Format: `sort name / phone / email / address / salary / claim / dep / dob [desc]
Examples:
- `sort name` to sort the employee list based on name in ascending order.
- `sort salary desc` to sort the employee list based on salary in descending order.
- `sort claim` to sort the employee list based on claim budget in ascending order.

Executing command: `sort name desc`

Expand Down Expand Up @@ -398,6 +408,7 @@ Format: `export [file_name]`
Examples:
- `list` followed by `export all_data` will download all employees' attributes into a csv file.
- `list d/Engineering` then `export engineering_team` will only download employees in engineering department.
- `birthday m/1` then `export birthday_Jan` will only download employees with birthdays in January.

![ExportCSVBeforeAfter](images/export.png)

Expand All @@ -412,6 +423,8 @@ Current available themes:

Examples:
- `theme red` Changes the application theme to the red theme.
- `theme light` Changes the application theme to light theme.
- `theme green` Changes the application theme to green theme.

Executing command: `theme light`

Expand Down
8 changes: 7 additions & 1 deletion docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Class "<<interface>>\nModel" as Model
Class AddressBook
Class ModelManager
Class UserPrefs
Class AddressBookList

Class UniquePersonList
Class Person
Expand All @@ -34,14 +35,19 @@ Model .left.> ReadOnlyAddressBook
ModelManager -left-> "1" AddressBook
ModelManager -right-> "1" UserPrefs
UserPrefs .up.|> ReadOnlyUserPrefs
ModelManager -down-> "1" AddressBookList
AddressBookList -up-> "*" AddressBook

AddressBook *--> "1" UniquePersonList
UniquePersonList --> "~* all" Person
Person *--> Name
Person *--> Phone
Person *--> Email
Person *--> Address
Person *--> "*" Tag
Person *--> Money
Person *--> Birthday
Person *--> Department
Person *--> Leave

Person -[hidden]up--> I
UniquePersonList -[hidden]right-> I
Expand Down
30 changes: 20 additions & 10 deletions docs/diagrams/UndoSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ end box

box Model MODEL_COLOR_T1
participant ":Model" as Model MODEL_COLOR
participant ":VersionedAddressBook" as VersionedAddressBook MODEL_COLOR
participant ":AddressBookList" as AddressBookList MODEL_COLOR
participant ":AddressBook" as AddressBook MODEL_COLOR
end box
[-> LogicManager : execute(undo)
[-> LogicManager : execute("undo")
activate LogicManager

LogicManager -> AddressBookParser : parseCommand(undo)
LogicManager -> AddressBookParser : parseCommand("undo")
activate AddressBookParser

AddressBookParser -> AddressBookParser : ensureEmptyArguments(args)

create UndoCommand
AddressBookParser -> UndoCommand
activate UndoCommand
Expand All @@ -31,17 +34,24 @@ deactivate AddressBookParser
LogicManager -> UndoCommand : execute()
activate UndoCommand

UndoCommand -> Model : undoAddressBook()
UndoCommand -> Model : undo()
activate Model

Model -> VersionedAddressBook : undo()
activate VersionedAddressBook
Model -> AddressBookList : undo()
activate AddressBookList

AddressBookList --> Model : addressBook

Model -> AddressBook : resetData(addressBook)
AddressBook --> Model :
deactivate AddressBook

Model -> AddressBookList : undoPastCommand()

VersionedAddressBook -> VersionedAddressBook :resetData(ReadOnlyAddressBook)
VersionedAddressBook --> Model :
deactivate VersionedAddressBook
AddressBookList --> Model : pastCommand
deactivate AddressBookList

Model --> UndoCommand
Model --> UndoCommand : pastCommand
deactivate Model

UndoCommand --> LogicManager : result
Expand Down
Binary file added docs/images/RedoSequenceDiagram.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 modified docs/images/UndoSequenceDiagram.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 e34849d

Please sign in to comment.