Skip to content

Commit

Permalink
Add planned enhancements for tag and insurance command
Browse files Browse the repository at this point in the history
Added planned enhancements for tag and insurance command
yucongkoo committed Nov 9, 2023
1 parent c98169b commit 5594971
Showing 4 changed files with 93 additions and 10 deletions.
59 changes: 51 additions & 8 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
@@ -191,6 +191,10 @@ This section describes some noteworthy details on how certain features are imple
This feature allows users to assign tags to / remove tags from customers in EzContact, increasing the recognizability
of customers to users.

The activity diagram below shows the action sequence of updating the tags of a customer.

<puml src="diagrams/tag-feature/ExecuteActivityDiagram.puml"/>

### Implementation

###### **Implementing `Tag`**
@@ -242,6 +246,10 @@ taking `parse(1 at/tall dt/short at/handsome)` call to the `TagCommandParser` as

###### **Implementing `TagCommand`**

The following class diagram illustrates how a `TagCommand` hold information required for its execution.

<puml src= "diagrams/tag-feature/TagCommandClassDiagram.puml" />

`TagCommand` plays the role of executing the tag command on a `Model`, it will update the `Model` accordingly to
reflect the changes after the tag command completes its execution. Note that if there are conflicting tags(i.e. there
is a common tag to add and delete), the command execution will fail.<br/>
@@ -982,7 +990,7 @@ Priorities: High - `* * *`, Medium - `* *`, Low - `*`
**Mss:**<br/>
&emsp;1. User requests to list out the customers.<br/>
&emsp;2. System displays the requested list of customers to the user.<br/>
&emsp;3. User enters index of targeted customer and information of tags to update.<br/>
&emsp;3. User enters index of targeted customer and information of tags to add or delete.<br/>
&emsp;4. System updates the tags of the specified customer accordingly.<br/>
&emsp;5. System displays the details of the updated customer.<br/>
&emsp;Use case ends.<br/>
@@ -1043,12 +1051,44 @@ Priorities: High - `* * *`, Medium - `* *`, Low - `*`

This section covers the enhancements we plan to implement in the future.

#### Enhancement
(details of the enhancement...)
#### Enhancement 1 : Deletion of all tags(and insurances) in a single command

**Feature flaw:** <br/>
As a customer might have many tags, and they could potentially want to remove all the
tags in one command, they would have to type out all the tags separately in order to achieve that.

**Proposed enhancement:**<br/>
We provide a convenient way for users to delete all the tags in one command by adding an optional parameter
to the command. The updated command format would be as follows: <br/>
`tag <index> [at/<tags to add>]... [dt/<tags to add>]... [dat/deleteall]`.

**Feature flaw:** (feature flaw it fixes...)
Justifications:
* As deleting all the tags is a destructive action, we require users to specify the `dat/` prefix to indicate
their interest in deleting all tags, and `deleteall` value to the prefix to serve as a confirmation of this
destructive command.

(explain how enhancement fixes the flaws... )
Updated behaviours (original behaviours of tag still hold):
* When a `dat/` prefix is supplied, there should not be any `at/` or `dt/` prefix supplied in the same command, if there
is, a format error message will be shown to the user.
* If the value provided to parameter `dat/` is not `deleteall`, show an error message to users, indicating that
they should supply the `deleteall` value to `dat/` in order to confirm the deletion.

**Examples:**<br/>
* `tag 1 dat/deleteall`<br/>
Expected: All the tags of customer at index 1 is deleted, a `successfully deleted all tags` message is shown to user.

* `tag 1 at/tall dat/deleteall`<br/>
Expected: Error, an error message showing the usage of tag command is shown to the user.

* `tag 1 dat/delete`<br/>
Expected: Error, an error message informing the user that they should input `deleteall` to confirm the deletion of all tags
is shown to the user.

**Additional notes:**<br/>
As the behaviour of the `insurance` command is nearly identical to `tag` command, this planned enhancement applies to
the `insurance` command too, the proposed enhancements and behaviours will be identical. The following is the updated
command format for `insurance` command:<br/>
`insurance <index> [ai/<insurance to add>]... [di/<insurance to delete>]... [dai/deleteall]`

--------------------------------------------------------------------------------------------------------------------
<div style="page-break-after: always;"></div>
@@ -1134,13 +1174,16 @@ Prerequisite : -
Expected : The tags assigned to the customer at index 1 will be updated accordingly(adds `tall` and `fat` tag, deletes `short` and `skinny` tag).

1. Test case : `tag 0 at/tall`<br/>
Expected : No customer is updated. Error details shown in the status message(format error since the index is not a positive integer).
Expected : Error, details shown in the status message(format error since the index is not a positive integer).

1. Test case : `tag 1`<br/>
Expected : No customer is updated. Error details shown in the status message(format error since no tag to update is provided).
Expected : Error, details shown in the status message(format error since no tag to update is provided).

1. Test case: `tag 1 at/tall dt/tall`<br/>
Expected : No customer is updated. Error details shown in the status message(conflicting tags).
Expected : Error, details shown in the status message(conflicting tags).

1. Test case: `tag 1 dt/dsajdkl`, the tag to delete does not exist in cutomer 1<br/>
Expected: Error, details shown in the status message(customer not updated).

<br/>

21 changes: 21 additions & 0 deletions docs/diagrams/tag-feature/ExecuteActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start
:User provides tags to add and delete;

'Since the beta syntax does not support placing the condition outside the
'diamond we place it as the true branch instead.
if () then
:Update tags of targeted customer;
if () then
:Save updated customer to Model;
else ([updated customer's tag set unchanged or invalid])
stop
endif
stop
else ([has conflicting tags to add and delete])
stop
endif
@enduml
17 changes: 17 additions & 0 deletions docs/diagrams/tag-feature/TagCommandClassDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@startuml
!include ../style.puml
skinparam arrowThickness 1.1
skinparam arrowColor LOGIC_COLOR
skinparam classBackgroundColor LOGIC_COLOR

Class TagCommand
Class Index
Class UpdatePersonTagsDescriptor
Class Tag

TagCommand --> "1" Index
TagCommand --> "1" UpdatePersonTagsDescriptor
UpdatePersonTagsDescriptor --> "~* tags to add" Tag
UpdatePersonTagsDescriptor --> "~* tags to delete" Tag

@enduml
6 changes: 4 additions & 2 deletions docs/team/yucongkoo.md
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ Given below are my contributions to the project.
helpful in identifying their customers.
* **Highlights:** This enhancement required an in-depth analysis of design alternatives, from choice of data structure to hold the
tags, to handling of certain user behaviours such as handling of duplicate tags provided, conflicting tags provided and
addition(deletion) of existing(non-existing).
addition(deletion) of existing(non-existing). The decisions made were mainly driven by ensuring the best user experience.
* **Credits:** The association between the `Tag` class and `Person` class was originally implemented in AB-3,
there was not much modification done to this association
<br/>
@@ -44,7 +44,8 @@ Given below are my contributions to the project.
conversion between json format and model type(PR [#103](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/103)). Throughout the process of refactoring,discovered and solved a bug in original AB-3 conversion[PR [#204](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/204)].
* Created UI componenet `FlowPaneLabel` used to display priority, tags and insurances associated to a customer (PRs [#162](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/162), [#208](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/208)).
* Updated the GUI color scheme and overall design (PR [#189](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/189))
* Added the functionality of secondary prefix, that is every prefix now has a shorthand representation and a full name representation (PR [#238](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/238))
* Added the functionality of secondary prefix, that is every prefix now has a shorthand representation and a full name representation,
while also making the prefixes not case-sensitive (PR [#238](https://github.com/AY2324S1-CS2103T-W16-2/tp/pull/238))
<br/>
<br/>

@@ -54,6 +55,7 @@ Given below are my contributions to the project.
* Added documentation for the features `add`, `tag` and also the `Advanced Features` section.
* Drafted the overall structure and formatting for features section to be used across team members.
* Added the `Prefix to full-name prefix translation table` section.
* Checked the degree of standardization between different sections of the UG.
* Tweaked the UG to make it pdf-version friendly.
* Developer Guide:
* Added the implementation details of the `tag` feature (including all the UML diagrams used in the explanation).

0 comments on commit 5594971

Please sign in to comment.