Skip to content

Commit

Permalink
Merge pull request #283 from L-rrrr/branch-udpate-dg
Browse files Browse the repository at this point in the history
Update developer guide
  • Loading branch information
rubinnn authored Nov 6, 2024
2 parents f379b4f + 4638593 commit 69aba23
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 38 deletions.
179 changes: 157 additions & 22 deletions docs/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,28 +219,28 @@ The following activity diagram summarizes what happens when a user executes a ad

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

| Priority | As a …​ | I want to …​ | So that I can…​ |
|----------|---------------------|---------------------------------------------------------------------------|-----------------------------------------------|
| `* * *` | financial advisor | add a new client’s contact details | easily manage my client base |
| `* * *` | financial advisor | view all of a client’s details on one screen | have all necessary information in one place. |
| `* * *` | financial advisor | delete outdated client contact information | keep my database clean and relevant |
| `* *` | financial advisor | search for a client by name or company | ensure that I always have the latest details |
| `* *` | financial advisor | categorize my clients (e.g., VIP, standard) | prioritize my communication with them |
| `*` | financial advisor | update a client’s contact information | ensure that I always have the latest details |
| `*` | financial advisor | tag clients with specific keywords (e.g., investor, retiree) | segment them for different services |
| `*` | financial advisor | add notes to a client’s profile | track important interactions or discussions |
| `*` | financial advisor | assign tasks related to each client (e.g., "Review investment portfolio") | stay organized and focused |
| Priority | As a …​ | I want to …​ | So that I can…​ |
|----------|---------------------|---------------------------------------------------------------------------------|-----------------------------------------------|
| `* * *` | financial advisor | add a new client’s contact details | easily manage my client base |
| `* * *` | financial advisor | view all of a client’s details on one screen | have all necessary information in one place. |
| `* * *` | financial advisor | delete outdated client contact information | keep my database clean and relevant |
| `* *` | financial advisor | search for a client by their personal information, such as name or phone number | ensure that I always have the latest details |
| `* *` | financial advisor | sort all clients in alphabetical order based on their names | prioritize my communication with them |
| `*` | financial advisor | update a client’s contact information | ensure that I always have the latest details |
| `*` | financial advisor | tag clients with specific client types (e.g., investor, retiree) | segment them for different services |
| `*` | financial advisor | add description to a client’s profile | track important interactions or discussions |
| `*` | financial advisor | assign reminders to each client (e.g., "Review investment portfolio") | stay organized and focused |

*{More to be added}*

### Use cases

(For all use cases below, the **System** is the `ClientHub` and the **Actor** is the `user`, unless specified otherwise)

**Use case: Add a new contact**
**Use case: Add a new client**

**MSS**
1. User requests to add a client's contact
1. User inputs the command to add a client's contact
2. ClientHub adds the contact to the list of contacts
3. ClientHub shows successful output message

Expand All @@ -262,16 +262,17 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

* 1c. ClientHub detects a duplicate contact

* 1c1. ClientHub informs user that there is more than one contact with the same name and prompts for confirmation
* 1c2. User confirms the addition of contact
* 1c1. ClientHub informs user that there is more than one contact with the same name and prompt the user to input a
different name.

Step 1 is repeated until user inputs a unique name.


Use case resumes at step 2.

**Use case: Delete a contact**
**Use case: Delete a client**

**MSS**

1. User requests to delete a contact
1. User keys in the command to delete a client
2. ClientHub deletes the person
3. ClientHub shows successful output message

Expand Down Expand Up @@ -305,13 +306,147 @@ Priorities: High (must have) - `* * *`, Medium (nice to have) - `* *`, Low (unli

**Extensions**

* 1a. ClientHub detects unknown command
* 1a1. ClientHub shows an error message that the command is not recognized

Use case ends.

**Use case: Search for a contact**

**MSS**
1. User inputs the command to search for a contact
2. ClientHub searches for the contact
3. ClientHub shows the contact details

Use case ends.

**Extensions**

* 1a. ClientHub detects invalid input format
* 1a1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.
* 1b. ClientHub detects that the given name is not in the list
* 1b1. ClientHub shows an error message that the name is not in the list

Use case ends.
* 1c. ClientHub detects multiple clients that matches the same name
* 1c1. ClientHub informs the user that multiple clients matches the same name and requests the user to input the full name of the client

* 1a1. ClientHub shows an error message
Step 1 is repeated until user inputs full name of the contact.

Step 1 is repeated until user inputs the correct format.
**Use case: Edit a client**

*{More to be added}*
**MSS**
1. User inputs the command to edit a client's contact
2. ClientHub edits the contact details
3. ClientHub shows successful output message

Use case ends.

**Extensions**

* 1a. ClientHub detects invalid input format
* 1a1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.
* 1b. ClientHub detects that the given name is not in the list
* 1b1. ClientHub shows an error message that the name is not in the list

Use case ends.
* 1c. ClientHub detects multiple contacts of the same name
* 1c1. ClientHub informs the user that there are multiple contacts with the same name and requests the user to input the full name of the contact

Step 1 is repeated until user inputs full name of the contact.

**Use case: Sort clients**

**MSS**

1. User inputs the command to sort clients
2. ClientHub sorts the clients in alphabetical order based on their names
3. ClientHub shows the sorted list of clients

Use case ends.

**Extensions**

* 1a. ClientHub detects unknown command
* 1a1. ClientHub shows an error message that the command is not recognized

Use case ends.
* 1b. ClientHub detects invalid input format
* 1b1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.

**Use case: Add reminder**

**MSS**

1. User inputs the command to add a reminder
2. ClientHub adds the reminder to the client
3. ClientHub shows successful output message
Use case ends.

**Extensions**

* 1a. ClientHub detects invalid input format
* 1a1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.
* 1b. ClientHub detects that the given name is not in the list
* 1b1. ClientHub shows an error message that the name is not in the list

Use case ends.
* 1c. ClientHub detects multiple contacts of the same name
* 1c1. ClientHub informs the user that there are multiple contacts with the same name and requests the user to input the full name of the contact

Step 1 is repeated until user inputs full name of the contact.
* 1d. ClientHub detects that the reminder is already added
* 1d1. ClientHub shows an error message that the reminder is already added

Use case ends.

**Use case: Delete reminder**

**MSS**

1. User inputs the command to delete a reminder
2. ClientHub deletes the reminder from the client
3. ClientHub shows successful output message
Use case ends.

**Extensions**

* 1a. ClientHub detects invalid input format
* 1a1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.
* 2a. ClientHub detects the given index is out of range
* 2a1. ClientHub shows an error message that the index is out of range

Step 1 is repeated until user inputs the correct format.


**Use case: Edit reminder**

**MSS**
1. User inputs the command to edit a reminder
2. ClientHub edits the reminder
3. ClientHub shows successful output message
Use case ends.

**Extensions**

* 1a. ClientHub detects invalid input format
* 1a1. ClientHub shows an error message that the input is in the wrong format

Step 1 is repeated until user inputs the correct format.
* 2a. ClientHub detects the given index is out of range
* 2a1. ClientHub shows an error message that the index is out of range

Step 1 is repeated until user inputs the correct format.

### Non-Functional Requirements

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class Messages {
public static final String MESSAGE_PERSON_NOT_FOUND = "The client cannot be found in the clientHub \n"
+ "Please use the list command to see all clients!";
public static final String MESSAGE_VAGUE_DELETE = "Please be more specific in the name \n"
+ "or use / to indicate the end of an EXACT name";
+ "or use $ to indicate the end of an EXACT name";
public static final String MESSAGE_PERSON_LISTED_OVERVIEW_FOR_VIEW = "%1$d client found for viewing!";
public static final String MESSAGE_NO_PERSON_FOUND_FOR_VIEW =
"No clients found please use the list command to see all clients";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public class AddCommand extends Command {

public static final String MESSAGE_SUCCESS = "New client added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This name already exists in Client Hub. If the "
+ "newly added client has the same name, Please add use () to add more information after the name "
+ "to differentiate the names.";
+ "newly added client has the same name, please use parenthesis to add more information after the name "
+ "to differentiate the clients.";

private final Person toAdd;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DeleteCommand extends Command {
+ SHORT_COMMAND_WORD + " John Doe \n"
+ "Additional Info: \n"
+ "- To delete a client with a common name, please provide fullname or\n"
+ "use / to indicate the end of the name eg Jon snow/";
+ "use $ to indicate the end of the name eg Jon snow$";

public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Client: %1$s";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public CommandResult execute(Model model) throws CommandException {
model.deleteReminder(reminderToDelete);

// Parse input using the NameContainsKeywordsPredicate
String fullName = reminderToDelete.getPersonName() + "/";
String fullName = reminderToDelete.getPersonName() + "$";
String[] nameKeywords = fullName.split("\\s+");
NameContainsKeywordsDeletePredicate predicate = new NameContainsKeywordsDeletePredicate(
List.of(nameKeywords));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public CommandResult execute(Model model) throws CommandException {
}

// Parse input using the NameContainsKeywordsPredicate
String fullName = reminderToEdit.getPersonName() + "/";
String fullName = reminderToEdit.getPersonName() + "$";
String[] nameKeywords = fullName.split("\\s+");
NameContainsKeywordsDeletePredicate predicate = new NameContainsKeywordsDeletePredicate(
List.of(nameKeywords));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DeleteCommandParser implements Parser<DeleteCommand> {
*/
public DeleteCommand parse(String args) throws ParseException {
String personNames = args.trim();
if (!Name.isValidName(personNames) && !personNames.endsWith("/")) {
if (!Name.isValidName(personNames) && !personNames.endsWith("$")) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
DeleteCommand.MESSAGE_USAGE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public FindNameCommand parse(String args) throws ParseException {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindNameCommand.MESSAGE_USAGE));
}
if (!trimmedArgs.matches("^[a-zA-Z()\\s]+$")) {
if (!trimmedArgs.matches("^[a-zA-Z()/$\\s]+$")) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, FindNameCommand.MESSAGE_USAGE));
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/seedu/address/model/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
public class Name {

public static final String MESSAGE_CONSTRAINTS =
"Names should only contain letters, space, parenthesis and slash, and it should not be blank";
"Names should only contain letters, space, parenthesis and slash, and it should not be blank. Names should "
+ "start with a letter and end with a letter or closing bracket.";

/*
* The first character of the address must not be a whitespace,
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "^[a-zA-Z()/]+[a-zA-Z()/\\s]*$";
public static final String VALIDATION_REGEX = "^[a-zA-Z]+[a-zA-Z()/\\s]*[a-zA-Z)]$";


public final String fullName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public NameContainsKeywordsDeletePredicate(List<String> keywords) {
public boolean test(Person person) {
if (keywords.isEmpty()) {
return false;
} else if (keywords.get(keywords.size() - 1).contains("/")) {
} else if (keywords.get(keywords.size() - 1).contains("$")) {
return isExact(person);
} else {
return keywords.stream()
Expand All @@ -50,7 +50,7 @@ public boolean test(Person person) {
* @return {@code true} if the concatenated keywords, without the trailing "/", match the person's full name.
*/
public boolean isExact(Person person) {
String fullname = String.join("", keywords).toLowerCase().split("/")[0].trim();
String fullname = String.join("", keywords).toLowerCase().split("\\$")[0].trim();
String personName = person.getName().fullName.trim().toLowerCase().replace(" ", "");
return fullname.equals(personName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public NameContainsKeywordsPredicate(List<String> keywords) {
public boolean test(Person person) {
if (keywords.isEmpty()) {
return false;
} else if (keywords.get(keywords.size() - 1).contains("/")) {
} else if (keywords.get(keywords.size() - 1).contains("$")) {
return isExact(person);
} else {
return keywords.stream()
Expand All @@ -38,7 +38,7 @@ public boolean test(Person person) {
* @return {@code true} if the concatenated keywords, match the person's full name.
*/
public boolean isExact(Person person) {
String fullname = String.join("", keywords).toLowerCase().split("/")[0].trim();
String fullname = String.join("", keywords).toLowerCase().split("\\$")[0].trim();
String personName = person.getName().fullName.trim().toLowerCase().replace(" ", "");
return fullname.equals(personName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public void test_isExact() {
assertFalse(predicate.isExact(new PersonBuilder().withName("Alice Bob").build()));

// Slash character ignored in matching
predicate = new NameContainsKeywordsPredicate(Arrays.asList("Alice", "Bob/"));
predicate = new NameContainsKeywordsPredicate(Arrays.asList("Alice", "Bob$"));
assertTrue(predicate.isExact(new PersonBuilder().withName("Alice Bob").build()));

// No match due to leading or trailing spaces
Expand All @@ -130,7 +130,7 @@ public void test_isExact() {
assertTrue(predicate.isExact(new PersonBuilder().withName("Alice Bob").build()));

// Multiple keywords without space between words
predicate = new NameContainsKeywordsPredicate(Arrays.asList("AliceBob/"));
predicate = new NameContainsKeywordsPredicate(Arrays.asList("AliceBob$"));
assertTrue(predicate.isExact(new PersonBuilder().withName("Alice Bob").build()));

// Different casing in keywords and person name
Expand Down

0 comments on commit 69aba23

Please sign in to comment.