Skip to content

Commit

Permalink
Merge pull request #206 from Ashuh/update-dg
Browse files Browse the repository at this point in the history
Update DG
  • Loading branch information
Ashuh authored Apr 11, 2022
2 parents f97e2ad + 7244252 commit f7258ec
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 42 deletions.
64 changes: 48 additions & 16 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ How the parsing works:

The `Model` component,
* stores the address book data i.e., all `Person` objects (which are contained in a `UniquePersonList` object).
* stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate _filtered_ list which is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed' e.g. the UI can be bound to this list so that the UI automatically updates when the data in the list change.
* stores the currently 'selected' `Person` objects (e.g., results of a search query) as a separate *filtered* list that is not exposed to outsiders.
* stores the *sorted* 'selected' `Person` objects (i.e., results of a sort operation) as a separate *sorted* list that 'observes' the *filtered* list, i.e., it updates itself whenever the data in the *filtered* list changes.
* The *sorted* list is exposed to outsiders as an unmodifiable `ObservableList<Person>` that can be 'observed', e.g., the UI can be bound to this list so that the UI automatically updates when the data in the list changes.
* stores a `UserPref` object that represents the user’s preferences. This is exposed to the outside as a `ReadOnlyUserPref` objects.
* does not depend on any of the other three components (as the `Model` represents data entities of the domain, they should make sense on their own without depending on other components)

Expand Down Expand Up @@ -282,27 +284,21 @@ This allows the user to be able to visualize his/her client's data to make bette

## Sorting

The sorting feature allows the user to sort the list of `Person` displayed.
The sorting feature is implemented by using a `SortedList<Person>` to observe the `FilteredList<Person>` in `ModelManager`. Whenever the data in the list containing all `Person` objects is changed, the `FilteredList<Person>` is notified first and will filter the data. Whenever the data in the `FilteredList<Person>` changes, the `SortedList<Person>` is notified and will sort the filtered data. This allows the *sort* feature to be used in conjunction with the *find* feature, i.e., it is possible to *sort* the results found by the *find* feature.

The following table shows the attributes that the list can be sorted by and their corresponding keywords.
The `SortedList<Person>` is exposed in the `Model` interface as `Model#getFilteredAndSortedPersonList()` while the `FilteredList<Person>` is not exposed.

| Attribute | Keyword |
|----------------------|----------------|
| `Name` | `name` |
| `Phone` | `phone` |
| `Email` | `email` |
| `Favourite` | `favourite` |
| `Address` | `address` |
| `UserType` | `usertype` |
| Number of `Property` | `num_property` |
Comparisons between `Person` objects are facilitated by `PersonComparator` which holds a list of `Comparator<Person>`. It implements `Comparator<Person>` and compares `Person` objects using the first `Comparator<Person>` in the list, followed by the subsequent elements in the event of a tie.

Sorting the list is done by using the `sort` command, which has the following syntax: `sort [KEYWORD]...`.
Given below is an example usage scenario.

If multiple attributes are specified, the first attribute is given the highest priority, while the last attribute is given the lowest priority. For example, `sort address name` will sort the list by `Address` first, followed by `Name` if `Address` is equal.
Step 1. The user launches the application. Both the `FilteredList<Person>` and `SortedList<Person>` will contain the same data as the list containing all `Person` objects.

The sorting feature is implemented by using a `SortedList<Person>` to observe the `FilteredList<Person>` in `ModelManager`.
Step 2. The user executes `find name john`, causing the `FilteredList<Person>` to only contain clients with `john` in their name.

Whenever the underlying application data is modified, the `FilteredList<Person>` is notified first and will filter the data. If there is any change in the `FilteredList<Person>`, the `SortedList<Person>` is notified and will sort the filtered data.
Step 3. The user executes `sort phone` to sort the clients according to their phone number. The `sort` command calls `Model#updateSortedPersonList()`. This in turn calls `FilteredList#setComparator()` which causes the `FilteredList<Person>` to sort the data it contains.

Step 4. The user executes `list` to list all clients, which causes the `FilteredList<Person>` to now contain all clients. The `SortedList<Person>` is automatically notified and sorts the new data in the `FilteredList<Person>`. Similarly, other commands that cause the data in the `FilteredList<Person>` to change, such as `add`, `delete`,`edit`,`favourite`, will cause the `SortedList<Person>` to automatically update itself.

## Feature `find` enhanced
In addition to the original `NameContainsKeywordsPredicate`, more predicates concerning each of the attributes in a `Person` are created.
Expand Down Expand Up @@ -561,6 +557,29 @@ Actor: User

Use case resumes at step 2

**Use Case: Sort**

Actor: User

**MSS**
1. User requests to sort the list of clients
2. REP displays clients in the requested order

Use case ends

**Extensions:**
* 1a. The list is empty

Use case ends


* 1b. REP detects an error in the entered command
* 1b1. REP displays an error message
* 1b2. User enters the sort command again
* Steps 1b1-1b2 are repeated until the command entered is valid

Use case resumes at step 2

## Non-functional Requirements

1. Should be able to work on any mainstream OS as long as it has Java 11 or above installed
Expand Down Expand Up @@ -674,6 +693,19 @@ Please bear in mind to extend your testing to more *exploratory* testing after f

## Sorting clients

1. Sorting clients while all clients are being shown.
1. Prerequisites: List all clients using the `list` command. Multiple clients in the list.
2. Test case: `sort address`<br/>
Expected: Clients in the list are sorted according to their address in lexicographical order (capitalization is ignored). The number of clients listed is shown in the result display.
3. Test case: `sort !phone`<br/>
Expected: Clients in the list are sorted according to their phone number in reverse numerical order. The number of clients listed is shown in the result display.
4. Test case: `sort address !phone`<br/>
Expected: Clients in the list are sorted according to their address in lexicographical order (capitalization is ignored) first. Clients with the same address are then sorted by their phone number in reverse numerical order. The number of clients listed is shown in the result display.
5. Test case: `sort invalid_key`<br/>
Expected: Clients are not sorted. Error details are shown in the result display and the list remains the same.
6. Other incorrect sort commands to try: `sort`, `sort name invalid_key`, `sort invalid_key name`, `...`<br/>
Expected: Similar to previous.

## Matching clients
1. Matching clients
1. Prerequisites: None. Ideally there are existing matches, otherwise the MatchWindow that pops up is empty.
Expand Down
45 changes: 19 additions & 26 deletions docs/team/ashuh.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,35 @@ title: Bryan Zheng's Project Portfolio Page

### Project: RealEstatePro

RealEstatePro is a desktop address book application used for teaching Software Engineering principles. The user interacts with it using a CLI, and it has a GUI created with JavaFX. It is written in Java, and has about 10 kLoC.
RealEstatePro is a desktop application for managing your client details for real estate agents. While it has a GUI, most of the user interactions happen using a CLI (Command Line Interface). With RealEstatePro managing your clients will be breeze by using the various features such as reminders, client matching and many more!

Given below are my contributions to the project.

* **New Feature**: Added the ability to undo/redo previous commands.
* What it does: allows the user to undo all previous commands one at a time. Preceding undo commands can be reversed by using the redo command.
* Justification: This feature improves the product significantly because a user can make mistakes in commands and the app should provide a convenient way to rectify them.
* Highlights: This enhancement affects existing commands and commands to be added in future. It required an in-depth analysis of design alternatives. The implementation too was challenging as it required changes to existing commands.
* Credits: *{mention here if you reused any code/ideas from elsewhere or if a third-party library is heavily used in the feature so that a reader can make a more accurate judgement of how much effort went into the feature}*
* **New Feature**: Added the ability to represent real estate listings using new classes: `Property`, `Region`, `Size`, `Price`.
* What it does: Represents the real estate listing of a client using the `Property` class which can be held by a `Person` object.
* Justification: This feature is required for the basic functionality of the application.
* Highlights: This feature was challenging to implement as it required significant changes to existing commands, and their unit tests.

* **New Feature**: Added a history command that allows the user to navigate to previous commands using up/down keys.
* **New Feature**: Added the ability to sort clients.
* What it does: Allows the user to sort clients according to one or more of their attributes. The sorting order for each attribute can also be reversed individually. This feature is integrated with the find feature, meaning that it is possible to sort the filtered list obtained after using the `find` command.
* Justification: This feature improves the product significantly because a user can have a large list of clients, and the application should provide a convenient way to organize them.
* Highlights: This feature was difficult to test as there are a large number of possible sorting orders.

* **Code contributed**: [RepoSense link]()
* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2122s2.github.io/tp-dashboard/?search=w16-4&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code~other&since=2022-02-18&tabOpen=true&tabType=authorship&tabAuthor=Ashuh&tabRepo=AY2122S2-CS2103-W16-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code&authorshipIsBinaryFileTypeChecked=false)

* **Project management**:
* Managed releases `v1.3` - `v1.5rc` (3 releases) on GitHub

* **Enhancements to existing features**:
* Updated the GUI color scheme (Pull requests [\#33](), [\#34]())
* Wrote additional tests for existing features to increase coverage from 88% to 92% (Pull requests [\#36](), [\#38]())
* Maintained the issue tracker

* **Documentation**:
* User Guide:
* Added documentation for the features `delete` and `find` [\#72]()
* Did cosmetic tweaks to existing documentation of features `clear`, `exit`: [\#74]()
* Added documentation for the command format used to specify a `Property`: [\#50](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/50)
* Added documentation for the `sort` feature: [\#67](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/67)
* Improved readability of user guide by using alerts: [\#187](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/187)
* Developer Guide:
* Added implementation details of the `delete` feature.
* Added implementation details of the `Property` feature.
* Added implementation details of the `sort` feature.

* **Community**:
* PRs reviewed (with non-trivial review comments): [\#12](), [\#32](), [\#19](), [\#42]()
* Contributed to forum discussions (examples: [1](), [2](), [3](), [4]())
* Reported bugs and suggestions for other teams in the class (examples: [1](), [2](), [3]())
* Some parts of the history feature I added was adopted by several other class mates ([1](), [2]())

* **Tools**:
* Integrated a third party library (Natty) to the project ([\#42]())
* Integrated a new Github plugin (CircleCI) to the team repo

* _{you can add/remove categories in the list above}_
* PRs reviewed (with non-trivial review comments): [\#74](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/74), [\#96](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/96), [\#43](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/43), [\#186](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/186), [\#94](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/94)
* Reported bugs in team member features (examples: [1](https://github.com/AY2122S2-CS2103-W16-4/tp/issues/68))
* Helped team members with issues related to their features: [\#55](https://github.com/AY2122S2-CS2103-W16-4/tp/pull/55)

0 comments on commit f7258ec

Please sign in to comment.