Skip to content

Commit

Permalink
Merge branch 'master' into Update_docs
Browse files Browse the repository at this point in the history
  • Loading branch information
howenc committed Oct 28, 2023
2 parents 19c391a + 8e78211 commit d9e3bee
Show file tree
Hide file tree
Showing 35 changed files with 174 additions and 266 deletions.
51 changes: 41 additions & 10 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,15 @@ As such, this section shall only detail the implementation of the `viewc` comman

When `viewc 2` is used, an instance of a `ViewContactCommand` (`ViewMeetingCommand` in the case of `viewm`) is created as shown in the following Sequence Diagram. This step does not differ from the way other commands have been shown to be created. The argument for our example would just be `2`, which would be stored as the `targetIndex` field of the `ViewContactCommand` object.

![ViewContactCommandSequenceDiagram](images/tracing/ViewContactCommandSequenceDiagram-View%20Contact%20Command%20Sequence.png)
![ViewContactCommandSequenceDiagram](images/tracing/ViewContactCommandSequenceDiagram-ViewContactCommandSequence.png)

Once the instance of `ViewContactCommand` is created, it is executed. During execution, the command stores the contents of its `targetIndex` field in the `ModelManager` using its `setViewedPersonIndex` method as shown in the next Sequence Diagram. For `ViewMeetingCommand` it would use the `setViewedMeetingIndex` method instead.

![StoreViewedItemsToModelDiagram](images/tracing/ViewCommandsSequenceDiagram-Store%20viewed%20Items%20to%20Model.png)
![StoreViewedItemsToModelDiagram](images/tracing/ViewCommandsSequenceDiagram-StoreViewedItemsToModel.png)

Once the indexes of the `Person` and `Meeting` objects to view (if any) are stored in `ModelManager`, their corresponding `Person` and `Meeting` objects (in this case the 2nd `Person` as displayed on the list) are obtained by the `MainWindow` as a `Pair` through the `getViewedItems` method of the `LogicManager` class. As such, both objects can then be forwarded to the `InfoDisplayPanel` using `setViewedModel`, which then displays detailed information of both objects. This process is denoted in the final Sequence Diagram below.

![ForwardViewedPersonMeetingtoUiDiagram](images/tracing/UiViewItemsSequenceDiagram-Forward%20Viewed%20Person%20&%20Meeting%20to%20Ui.png)

![ForwardViewedPersonMeetingtoUiDiagram](images/tracing/UiViewItemsSequenceDiagram-ForwardViewedPerson&MeetingToUi.png)
#### Design Considerations and Rationale

1. Passing viewed `Person` and `Meeting` from Model to Ui through Logic:
Expand All @@ -191,7 +190,10 @@ Once the indexes of the `Person` and `Meeting` objects to view (if any) are stor
- Storing a copy of the objects was done initially but led to a display issue.
- When the fields of any currently viewed item are edited, the display does not update as the copy of the original viewed item does not get updated as well.
- Storing the `Index` fixes this issue as the `Person` and `Meeting` objects are only forwarded to the Ui after the execution of a command.
- This does lead to a separate issue where deleting a `Person` or `Meeting` object might lead to the wrong item being displayed due to a change in displayed list index. A simple solution is to simply reset the viewed item in question to nothing until their respective view commands are used again.
4. As a continuation to point 3, this leads to a new issue with commands that can modify the display list length/order such as `editc`, `findc`, `deletec` and their meeting variants.
- Since the stored `Index` may now reference a different item, or even point out-of-bounds in the case of the display list being shortened, this implementation may potentially lead to unpredictable results for both view commands.
- For the case of `editc` and `editm`, this is judged to not be an issue as the view commands still obey their definition of displaying the item at a specified list index.
- For the case of `deletec`, `deletem`, `findc` and `findm`, a simple fix is to simply set the stored `Index` to null only for these commands.


### Find meeting feature
Expand All @@ -201,6 +203,7 @@ Once the indexes of the `Person` and `Meeting` objects to view (if any) are stor
The find meeting command is facilitated by `GeneralMeetingPredicate` that by itself is the combined predicate for all the meeting data fields. It is placed within the Model component and is only dependent on other predicate classes and `Meeting`.

`findm` is supported by 5 sub-predicates that would search their respective fields.

- m/TITLE_KEYWORDS  —  Finds meetings which `Title` contain any of the keywords given using `TitleContainsKeywordsPredicate`.
- a/LOCATION_KEYWORDS  —  Finds meetings which `Location` contain any of the keywords given using `LocationContainsKeywordsPredicate`.
- n/ATTENDEE_KEYWORDS  —  Finds meetings which set of `Attendee` contain any of the keywords given using `AttendeeContainsKeywordsPredicate`.
Expand Down Expand Up @@ -231,11 +234,13 @@ The following diagrams show the entire sequence flow for `LogicManager#execute()
- `MeetingTime`is needed to check the validity of START and END in order for `parse()` to stop any invalid inputs, it cannot be removed.

### Add attendee feature

User can specify a Person to add as an Attendee to a specified Meeting.

To avoid storing an entire `JsonAdaptedPerson` object within the `JsonAdaptedMeeting` every time a `Person` is added to a `Meeting`,
we created the `Attendee` class to store a unique identifier for the `Person` added.
As every `Person` has a unique name in the current iteration, `Attendee` is implemented in the following way:

- `Attendee(attendeeName)` -- Initialized with a String obtained from `Person.getName().toString()`
- `Attendee#getAttendeeName()` -- Returns a String representing the attendee's name

Expand All @@ -248,6 +253,7 @@ The following sequence diagram shows how the add attendee operation works:
A Person object can be obtained from a Meeting's list of attendees by searching through `UniquePersonList`
for a `Person` with a name matching `attendeeName`.


### Remove attendee feature
User can specify an Attendee to remove from a specified Meeting by specifying its index in the list of Attendees.
This is the main motivation behind using a LinkedHashSet for the implementation of the Attendee Set.
Expand All @@ -256,6 +262,7 @@ The following sequence diagram shows how the remove attendee operation works:

![RemoveAttendeeSequenceDiagram](images/RemoveAttendeeSequenceDiagram.png)


### \[Proposed\] Undo/redo feature

#### Proposed Implementation
Expand Down Expand Up @@ -337,9 +344,34 @@ The following activity diagram summarizes what happens when a user executes a ne

_{more aspects and alternatives to be added}_

### \[Proposed\] Data archiving
### Keeping track of last meeting with contact

Keeping track of the user's last meeting with their contact is facilitated by the addition of a `LastContactedTime` object to `Person`.
Thus, each instance of `Person` will contain an immutable `LastContactedTime` object that stores the user's last meeting with that contact.
The following steps shows how `LastContactedTime` is implemented and utilized in the application.

Step 1. The user inputs the `addc` command into the `CommandBox` input field, with the added field `l/[LAST_CONTACTED_TIME]`.

_{Explain here how the data archiving feature will be implemented}_
The following diagram summarizes steps 2 to 6:
<img src="images/LastContactedTime1.png" width="1000" />

Step 2. Entering a correct command with the `Enter` key then calls `execute` on `LogicManager`.
Step 3. `LogicManager` then calls `AddressBookParser#parseCommand(commandText)` on the `commandText` String, which recognizes that it is an `addc` command.
Step 4. `AddressBookParser` then calls `AddCommandParser#parse()` on the command arguments.
Step 5. `AddCommandParser` then calls `ParserUtil#parseContactTime()` which parses the last contacted time and returns a `LocalDateTime` object called `lastContactedTime`.
Step 6. The `lastContactedTime` object is then passed to the `Person` constructor, which creates a new `Person` that calls the `LastContactedTime` constructor with it.

The following diagram summarizes steps 7 and 8:
<img src="images/LastContactedTime2.png" width="1000" />

Step 7. The completed `Person` is passed to an `AddCommand` constructor which return a new `AddCommand` that can be executed.
Step 8. `LogicManager` then executes the `AddCommand` on the application model.
Step 9. Futher execution is carried out, which like before adds the `Person` object to the list of `Person`s in the `Model`, and updates the `Storage` with this new `Person`.

#### Design Consideration: Updating last meeting with contact

Solution:
This is facilitated by the addition of the `MarkDoneCommand`. When a meeting is marked as done, the attendees of the meeting will be updated with their LastContactedTime field updated to the end time of the meeting.

---

Expand Down Expand Up @@ -370,7 +402,6 @@ _{Explain here how the data archiving feature will be implemented}_

Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unlikely to have) - `*`


| Priority | As a …​ | I want to …​ | So that I can…​ |
| -------- | ----------------------------------------- | ------------------------------- | ------------------------------------- |
| `[EPIC]` | agent who has meetings | have a meeting schedule | keep track of them |
Expand All @@ -395,7 +426,6 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
| `* * *` | agent | view contacts in meetings | |
| `*` | agent who wants to meet clients regularly | know the last contacted date | when to touch base with a client |


_{More to be added}_

### Use case
Expand Down Expand Up @@ -451,6 +481,8 @@ _{More to be added}_
4. OutBook shows the details of the meeting.
4. User requests to remove a specific contact from the meeting.
5. OutBook removes the contact from the meeting.
5. User requests to remove a specific contact from the meeting.
6. OutBook removes the contact from the meeting.

Use case ends.

Expand Down Expand Up @@ -482,7 +514,6 @@ _{More to be added}_

Use case resumes at step 3.


**Use case: Mark meeting as complete**

**MSS**
Expand Down
42 changes: 36 additions & 6 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,14 @@ Format: `help`

Adds a contact to OutBook.

<<<<<<< HEAD
Format: `addc n/NAME p/PHONE_NUMBER e/EMAIL l/LAST_CONTACTED_TIME s/STATUS [r/REMARK][t/TAG]…​`
=======
Format: `addc n/NAME p/PHONE_NUMBER e/EMAIL lc/LAST_CONTACTED_TIME [s/STATUS] [r/REMARK] [t/TAG]…​`
>>>>>>> master
* NAME, PHONE_NUMBER, and EMAIL are compulsory fields. STATUS, TAG and LAST_CONTACTED_TIME are optional.

* NAME, PHONE_NUMBER, EMAIL and LAST_CONTACTED_TIME are compulsory fields. STATUS, REMARK and TAG are optional.
* PHONE_NUMBER must contain only numbers, and be at least 3 digits long.
* EMAIL must be of the format local-part@domain and adhere to the following constraints:
1. The local-part should only contain alphanumeric characters and these special characters, excluding the parentheses, (+_.-).
Expand All @@ -115,14 +120,18 @@ Format: `addc n/NAME p/PHONE_NUMBER e/EMAIL l/LAST_CONTACTED_TIME s/STATUS [r/RE
You can put any number of tags (including 0) on a contact.
</div>

* `addc n/John Doe p/98765432 e/[email protected] l/01.10.2023 1000`
* `addc n/Betsy Crowe t/friend e/[email protected] p/1234567 l/01.01.2023 0100 t/Professor`
* `addc n/John Doe p/98765432 e/[email protected] lc/01.10.2023 1000`
* `addc n/Betsy Crowe t/friend e/[email protected] p/1234567 lc/01.01.2023 0100 t/Professor`

<br/><br/>

### Listing all persons : `listc`

<<<<<<< HEAD
Shows you a list of all contacts in OutBook.
=======
Shows a list of all contacts in OutBook. Contacts are sorted by LAST_CONTACTED_TIME by default.
>>>>>>> master
Format: `listc`

Expand All @@ -141,6 +150,25 @@ Examples:
* `listc` followed by `delete 2` deletes the 2nd person in the results of the `listc` command.
* `findc Betsy` followed by `delete 1` deletes the 1st person in the results of the `findc` command.


### Editing a contact : `editc`

Edits an existing contact in OutBook.

Format: `editc INDEX [n/NAME] [p/PHONE] [e/EMAIL] [lc/LAST_CONTACTED_TIME] [s/STATUS] [s/REMARK] [t/TAG]…​`

* Edits the contact at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, …​
* All fields are optional, but at least one must be provided.
* Existing values will be updated to the input values.
* When editing tags, the existing tags of the person will be removed i.e adding of tags is not cumulative.
* You can remove all the person’s tags by typing `t/` without
specifying any tags after it.

Examples:
* `editc 1 p/91234567 e/[email protected]` Edits the phone number and email address of the 1st person to be `91234567` and `[email protected]` respectively.
* `editc 2 n/Betsy Crower t/` Edits the name of the 2nd person to be `Betsy Crower` and clears all existing tags.


### Viewing detailed contact information : `viewc`

Views detailed information of a contact in OutBook.
Expand All @@ -151,6 +179,7 @@ Format: `viewc INDEX`
* The index refers to the index number shown in the displayed person list.
* The index **must be a positive integer** 1, 2, 3, …​
* Displays contact Name, Phone, Email, Last Contacted Time, Status, Remarks and Tags.
* The displayed contact is reset when the `deletec` and `findc` commands are used.

Examples:
* `viewc 2` Displays detailed information related to the 2nd contact on the list.
Expand Down Expand Up @@ -194,7 +223,7 @@ Format: `remark INDEX r/REMARK`
### Search for persons using contact fields: `findc`
Find persons whose contact details match the keywords specified for at least 1 of these fields: name, phone, email, status, tag

Format: `findc [n/KEYWORDS] [p/KEYWORDS] [e/KEYWORDS] [l/DATETIME] [s/KEYWORDS] [t/KEYWORDS]`
Format: `findc [n/KEYWORDS] [p/KEYWORDS] [e/KEYWORDS] [lc/DATETIME] [s/KEYWORDS] [t/KEYWORDS]`

* The search is case-insensitive. e.g `shop` will match `SHOP`
* The order of the keywords does not matter. e.g. `Shop Meet` will match `Meet Shop`
Expand Down Expand Up @@ -235,7 +264,7 @@ Examples:

### Listing all meetings : `listm`

Shows you a list of all meetings in OutBook.
Shows a list of all meetings in OutBook. Meetings are sorted by START by default.

Format: `listm`

Expand Down Expand Up @@ -282,7 +311,8 @@ Format: `viewm INDEX`
* Views detailed information of the meeting at the specified `INDEX`.
* The index refers to the index number shown in the displayed meeting list.
* The index **must be a positive integer** 1, 2, 3, …​
* Displays meeting Title, Location, Meeting times, Attendees and Tags.
* Displays meeting Title, Location, Start/End, Attendees and Tags.
* The displayed meeting is reset when the `deletem` and `findm` commands are used.

Examples:
* `viewm 2` Displays detailed information related to the 2nd meeting on the list, including current attendees.
Expand Down
14 changes: 11 additions & 3 deletions docs/diagrams/tracing/UiViewItemsSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@ skinparam ArrowFontStyle plain

title Forward Viewed Person & Meeting to Ui

Participant "UiPart:MainWindow" as window LOGIC_COLOR
box UI UI_COLOR_T1
Participant "UiPart:MainWindow" as window UI_COLOR
Participant ":InfoDisplayPanel" as info UI_COLOR
end box

box Logic LOGIC_COLOR_T1
Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":ModelManager" as model LOGIC_COLOR
Participant ":InfoDisplayPanel" as info LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":ModelManager" as model MODEL_COLOR
end box

[-> window : executeCommand
activate window
Expand Down
9 changes: 8 additions & 1 deletion docs/diagrams/tracing/ViewCommandsSequenceDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,24 @@ skinparam ArrowFontStyle plain

title Store viewed Items to Model

box Logic LOGIC_COLOR_T1
Participant ":LogicManager" as logic LOGIC_COLOR
Participant ":AddressBookParser" as abp LOGIC_COLOR
Participant "command:ViewContactCommand" as vcc LOGIC_COLOR
Participant ":ModelManager" as model LOGIC_COLOR
end box

box Model MODEL_COLOR_T1
Participant ":ModelManager" as model MODEL_COLOR
end box

[->logic : execute
activate logic
ref over logic, abp, vcc: View Contact Command Sequence
logic -> vcc ++: execute(model)
vcc -> model ++: setViewedPersonIndex(targetIndex)
model --> vcc --:
vcc --> logic --: CommandResult
[<--logic
deactivate logic

@enduml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Participant ":AddressBookParser" as abp LOGIC_COLOR
Participant ":ViewContactCommandParser" as vccp LOGIC_COLOR
Participant "command:ViewContactCommand" as ec LOGIC_COLOR

[-> logic : execute

activate logic
logic -> abp ++: parseCommand(commandText)
create vccp
Expand Down
Binary file added docs/images/LastContactedTime1.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 added docs/images/LastContactedTime2.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 not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/team/juzzztinsoong.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ My contributions to the project are listed below.
- User Guide
- Update parts of User Guide on `addc`, `editc` and `addm`.
- Developer Guide
- Add implementation notes on LastContactedTime field
- Non-functional Requirements
- Glossary

Expand Down
3 changes: 2 additions & 1 deletion docs/team/lomaply.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ My contributions to the project are listed below.
- Review and merge pull requests

- **Enhancements to existing features**:


- Sort contacts by last contacted time
- New Command
- "editm"
- Command to edit fields of existing meetings
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class AddCommand extends Command {
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ "[" + PREFIX_LASTTIME + "LAST CONTACTED TIME] "
+ PREFIX_LASTTIME + "LAST CONTACTED TIME "
+ "[" + PREFIX_STATUS + "STATUS] "
+ "[" + PREFIX_REMARK + "REMARK] "
+ "[" + PREFIX_TAG + "TAG]...\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public CommandResult execute(Model model) throws CommandException {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
}

model.setViewedPersonIndex(null);
Person personToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deletePerson(personToDelete);
model.setViewedPersonIndex(null);
return new CommandResult(String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(personToDelete)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public CommandResult execute(Model model) throws CommandException {
throw new CommandException(Messages.MESSAGE_INVALID_MEETING_DISPLAYED_INDEX);
}

model.setViewedMeetingIndex(null);
Meeting meetingToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deleteMeeting(meetingToDelete);
model.setViewedMeetingIndex(null);
return new CommandResult(String.format(MESSAGE_DELETE_MEETING_SUCCESS, Messages.format(meetingToDelete)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public FindMeetingCommand(GeneralMeetingPredicate predicate) {
public CommandResult execute(Model model) {
logger.info("Begin FindMeetingCommand execution");
requireNonNull(model);
model.setViewedMeetingIndex(null);
model.updateFilteredMeetingList(predicate);
return new CommandResult(
String.format(Messages.MESSAGE_MEETINGS_LISTED_OVERVIEW, model.getFilteredMeetingList().size()));
Expand Down
Loading

0 comments on commit d9e3bee

Please sign in to comment.