Skip to content

Commit

Permalink
Merge pull request #282 from chewbum/branch-addMeeting-diagram
Browse files Browse the repository at this point in the history
Add addMeeting diagram
  • Loading branch information
sethteo authored Apr 14, 2024
2 parents a987e14 + f221b08 commit c7f17c4
Show file tree
Hide file tree
Showing 5 changed files with 143 additions and 15 deletions.
95 changes: 80 additions & 15 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ title: Developer Guide
- 3.5. [Storage Component](#storage-component)
- 3.6. [Common Classes](#common-classes)
4. [Implementation](#implementation)
- 4.1. [Release v1.2](#release-v12)
- 4.1.1. [Delete Meeting feature](#edit-meeting-feature)
- 4.1.2. [Delete Meeting feature](#delete-meeting-feature)
- 4.2. [Release v1.3](#release-v13)
- 4.2.1 [Filter feature](#filter-feature)
- 4.1. [Release v1.2](#release-v12)
- 4.1.1. [Add Meeting feature](#add-meeting-feature)
- 4.1.2. [Edit Meeting feature](#edit-meeting-feature)
- 4.1.3. [Delete Meeting feature](#delete-meeting-feature)
- 4.2. [Release v1.3](#release-v13)
- 4.2.1 [Filter feature](#filter-feature)
5. [Appendix: Requirements](#appendix-requirements)
6. [Appendix: Instructions for manual testing](#appendix-instructions-for-manual-testing)
7. [Appendix: Planned enhancements](#appendix-planned-enhancements)
Expand Down Expand Up @@ -181,6 +182,68 @@ This section describes some noteworthy details on how certain features are imple

### Release v1.2

### Add Meeting feature

#### Implementation

**The `AddMeetingCommand` is implemented as such:**

- `LogicManager`'s execute method is called with the command string which then calls the `parseCommand()` method of `AddressBookParser`
- `AddressBookParser` then creates a `AddMeetingCommandParser` which parses the user input and
returns a `AddMeetingCommand`
- The created `AddMeetingCommand` is then executed by the `LogicManager`
- `AddMeetingCommand` adds the meeting to the client's meeting list corresponding to the index provided by the user.
- The UniqueMeetingList object in the Model is updated with the new meeting
- `AddMeetingCommand` creates a `CommandResult` object and returns it to `LogicManager`
- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list with the added meeting

**The `AddMeetingCommandParser` is implemented as such:**

- Takes in a `String` input from the user
- Splits the given `String` and checks if there is more than 1 string provided
- If more than 1 string was provided, throws `ParseException`
-Parser then checks if required prefixes are provided
- If not, throws `ParseException`
- Parser then checks if an empty string was provided
- If yes, throws `ParseException`
- Parser then checks if duplicate prefixes are provided
- If yes, throws `ParseException`
- Parser then checks if the date, time, description and client index are valid
- If not, throws `ParseException`
- If no exception was thrown, the index corresponding to the `Person`, the date, time and description are used to create a `AddMeetingCommand` object

#### Sequence Diagram

The following activity diagrams show how the `AddMeetingCommand` and `AddMeetingCommandParser` are executed in the event of valid and invalid user input.

The first diagram shows how the AddMeetingCommandParser works when valid and invalid user input is given:<br>
<img src="images/AddMeetingCommandParserActivityDiagram.png" width="1566" alt="AddMeetingCommandParser activity diagram"/>

The second diagram shows how the AddMeetingCommand is executed when the user inputs a valid and invalid command:<br>
<img src="images/AddMeetingCommandActivityDiagram.png" width="1566" alt="AddMeetingCommand activity diagram"/>


#### Design considerations:

**Aspect: How add meeting executes:**

- **Alternative 1 (current choice):** Adds the meeting based on the client index, date, time and description provided by the user
- Pros:
* More realistic as we would need to consider for conflicting meetings for the same client.
* Easier to visualise the different scenarios that could happen.
- Cons:
* More complex to implement.
* More error-prone as the user needs to provide the date and time.

- **Alternative 2:** Adds the meeting based on the date and time provided by the user
- Pros:
* More flexible.
* More user-friendly.
- Cons:
* Unable to add meetings based on other criteria such as client index, description, etc.
* Less realistic as we would need to consider for conflicting meetings for the same client.


### Edit Meeting feature

#### Implementation
Expand Down Expand Up @@ -234,23 +297,22 @@ The following activity diagram summarises what happens when a user executes the
- `DeleteMeetingCommand` deletes the meeting of the client corresponding to the indices provided
by the user.
- `DeleteMeetingCommand` creates a `CommandResult` object and returns it to `LogicManager`
- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list without the deleted meeting
- `LogicManager` then passes `CommandResult` to `UI` who then displays the `Meeting` list without
the deleted meeting

**The `DeleteMeetingCommandParser` is implemented as such:**

- Takes in a `String` input from the user
- Splits the given `String` and checks if the prefixes `clientIndex/` and `meetingIndex/` are provided
- If not, throws `ParseException`
- Parser checks if any duplicate prefixes are provided
- If yes, throws `ParseException`
- Splits the given `String` and checks if there is more than 1 string provided
- If more than 1 string was provided, throws `ParseException`
- Parser then checks if an empty string was provided
- If yes, throws `ParseException`
- If no exception was thrown, the indices corresponding to the `Person` and the `Meeting`
- If no exception was thrown, the indices corresponding to the `Person` and the `Meeting`
are used to create a `DeleteMeetingCommand` object

#### Sequence Diagram

The following sequence diagrams show how the `DeleteMeetingCommand` is executed when the user
The following sequence diagrams show how the `DeleteMeetingCommand` is executed when the user
inputs the command `deleteMeeting clientIndex/2 meetingIndex/2`.

The first diagram shows how the command goes through the `Logic` component:<br>
Expand Down Expand Up @@ -519,7 +581,7 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli
- **Use Case**: A description of a specific user goal or task and the steps required to achieve it.
- **Mainstream OS**: Windows, Linux, Unix, MacOS
- **Private contact detail**: A contact detail that is not meant to be shared with others
- **CLI**: A command line interface (CLI) is a software mechanism you use to interact with your
- **CLI**: A command line interface (CLI) is a software mechanism you use to interact with your
operating system using your keyboard.

---
Expand Down Expand Up @@ -624,7 +686,7 @@ testers are expected to do more *exploratory* testing.

3. Test case: `filter [invalid tag]`
Expected: Shows all clients. Error details that tag provided does not belong to any client.

4. Test case: `filter [tag_1] [tag_2]`
Expected: Error thrown to tell user to only input a singular Tag

Expand All @@ -638,7 +700,10 @@ testers are expected to do more *exploratory* testing.
1. Test case: ` addMeeting clientIndex/1 dt/02-01-2030 12:00 d/sign life plan`<br>
Expected: A new meeting is added to the list. The meeting's details are shown in the list,
and the status bar shows the meeting's details.

1. Test case: `addMeeting clientIndex/0 dt/02-01-2030 12:00 d/sign life plan`<br>
Expected: Meeting is not added. Index should be one-based. Error details shown in the status message.
1. Test case: `addMeeting clientIndex/2 dt/02-01-2030 12:00 d/sign life plan`<br>
Expected: Meeting is added to the list as different client with the same description at the same date and time is allowed. The meeting's details are shown in the list, and the status bar shows the meeting's details.
1. Test case: `addMeeting clientIndex/1 dt/02-01-2024 12:00 d/sign life plan`<br>
Expected: Meeting is not added because the date has already elapsed. Error details shown in
status message.
Expand Down
24 changes: 24 additions & 0 deletions docs/diagrams/AddMeetingCommandActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User executes AddMeeting command;

if () then ([Invalid parameters])
-Error: Invalid command format
stop
else ([Valid parameters])
if () then ([Duplicate meeting])
-Error: This meeting either already exists in the address book or you are already booked for this timing
stop
else ([Meeting not duplicate])
:Add new meeting to client's meeting list;
:Add new meeting to UniqueMeetingList;
:Commit changes to AddressBook;
:Save AddressBook state;
stop


endif
@enduml
39 changes: 39 additions & 0 deletions docs/diagrams/AddMeetingCommandParserActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:Create AddMeetingCommandParser object;

if () then ([clientIndex not present])
:Throw ParseException;
stop
else ([clientIndex present])
if () then ([clientIndex not valid])
:Throw ParseException;
stop
else ([clientIndex valid])
:Parse ClientIndex;
if () then ([datetime not present])
:Throw ParseException;
stop
else ([datetime present])
:Parse DateTime;
if () then ([datetime not valid])
:Throw ParseException;
stop
else ([datetime valid])
:Parse Description;
if () then ([description not present])
:Throw ParseException;
stop
else ([description present])
if () then ([description not valid])
:Throw ParseException;
stop
else ([description valid])
:Create AddMeetingCommand object;
stop

endif
@enduml
Binary file added docs/images/AddMeetingCommandActivityDiagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 c7f17c4

Please sign in to comment.