Skip to content

Commit

Permalink
Merge pull request #122 from tayian/branch-bugFixSharePerson
Browse files Browse the repository at this point in the history
Bug fix for SharePersonCommand.java
  • Loading branch information
tayian authored Nov 8, 2023
2 parents 16f9ad4 + 0f3b4d8 commit ceecb5e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 8 additions & 8 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ As a new user, your Connectify database is empty. Let's add your first connectio
Phone: 98765432
Address: 1 Infinite Loop, Cupertino, California
```

The company has been successfully added to your Connectify database! You should be able to see the company in your database as shown below:

![Adding First Company](images/tutorial_addingFirstCompany.png)

2. Now that you've added a company to your Connectify database, it's time to add a person to your database. The example that we would be using is `addPerson n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney c/1 pr/1`. This command adds a person named "John Doe" to your Connectify database with the relevant details of the person as specified in the command. The output of this command is shown below:
Expand All @@ -102,7 +102,7 @@ As a new user, your Connectify database is empty. Let's add your first connectio
Company: Apple Inc;
Tags: [owesMoney][friends]
```

The person has been successfully added to your Connectify database! You should be able to see the person in your database as shown below:

![Adding First Person](images/tutorial_addingFirstPerson.png)
Expand Down Expand Up @@ -436,7 +436,7 @@ You should see Connectify display the command to be copied, as shown below. The

- If the specified index is missing or is not a positive integer, you will get the following error message:
```
Invalid command format!
Invalid command format!
shareCompany: Shares instructions on how to add a Company to another address book.
Parameters: INDEX (must be a positive integer)
Example: shareCompany 1
Expand Down Expand Up @@ -559,7 +559,7 @@ Tags: [owesMoney][friends]

- If the specified person/company index is missing or is not a positive integer, you will get the following error message:
```
Invalid command format!
Invalid command format!
deletePerson: Deletes the person identified by the index number from the specified company and also removes them from the address book.
Parameters: COMPANY_INDEX (must be a positive integer) PERSON_INDEX (must be a positive integer)
Example: deletePerson 2 1
Expand Down Expand Up @@ -743,7 +743,7 @@ Added note to Person: connectify.model.person.Person{name=Joe Doe, phone=9876543
- If the specified company index is missing, you will get the following error message:
```
Invalid command format!
Invalid command format!
notePerson: Changes the note of the person identified by the index number used in the displayed person list. Existing note will be overwritten by the input.
Parameters: COMPANY_INDEX PERSON_INDEX (must be a positive integer) [r/NOTE]
Example: notePerson 1 1 r/Likes to swim.
Expand Down Expand Up @@ -836,7 +836,7 @@ sharePerson 1 1
Command to add this Person:
addPerson n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 n/Note n/Company t/owesMoneyfriends
Do take note that you need to specify Company and priority on your own.
```
```
You should see Connectify display the command to be copied, as shown below. The command can be copied and sent to another person, who can then add the company to their Connectify database by pasting the command into the command box and pressing enter.
Expand All @@ -846,7 +846,7 @@ You should see Connectify display the command to be copied, as shown below. The
- If the specified company/person index is missing or is not a positive integer, you will get the following error message:
```
Invalid command format!
Invalid command format!
sharePerson: Shares instructions on how to add a Person, from the specified company, to another address book.
Parameters: COMPANY_INDEX (must be a positive integer) PERSON_INDEX (must be a positive integer)
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class SharePersonCommand extends Command {
+ "Example: " + COMMAND_WORD + " 2 1";

public static final String MESSAGE_SHARE_PERSON_SUCCESS = "Command to add this Person:\n%1$s\n"
+ "Do take note that you need to specify Company and priority on your own.";
+ "Do take note that you need to specify Company, priority, "
+ "and any additional notes on your own.";

private final Index companyIndex;
private final Index personIndex;
Expand Down Expand Up @@ -92,8 +93,11 @@ public static String formatInput(String input) {
case "Address":
result.append("a/").append(value).append(" ");
break;
case "Note":
case "Company":
break;
case "Tags":
String[] tags = value.replace("[", "").replace("]", "").split("]\\[");
String[] tags = value.substring(1, value.length() - 1).split("]\\[");
for (String tag : tags) {
result.append("t/").append(tag).append(" ");
}
Expand Down

0 comments on commit ceecb5e

Please sign in to comment.