Skip to content

Commit

Permalink
Merge pull request #187 from geraldngjx/branch-fix-bugs
Browse files Browse the repository at this point in the history
Fix bugs and update PPP
  • Loading branch information
geraldngjx authored Nov 8, 2023
2 parents ceecb5e + 1b18610 commit f37ba3a
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 89 deletions.
61 changes: 48 additions & 13 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,18 @@ You should be able to see the company in Connectify as shown below:

**Unsuccessful Output:**

- If any of the compulsory placeholders such as `n/`, `i/`, `l/`, `d/`, `w/`, `e/`, `p/` or `a/` are missing, you will receive the following error message:
```
Invalid command format!
addCompany: Adds a company to the address book. Parameters: n/NAME i/INDUSTRY l/LOCATION d/DESCRIPTION w/WEBSITE e/EMAIL p/PHONE a/ADDRESS
Example: addCompany n/TechCorp i/Technology l/Silicon Valley d/Leading tech company w/www.techcorp.com e/[email protected] p/12345678 a/123 Tech St, Silicon Valley
```

- If all compulsory placeholders are present but the details are missing, you will receive the following error message:
```
Names should only contain alphanumeric characters and spaces, and it should not be blank
```

- If a company with the same details already exists in the address book:
```
This company already exists in the address book.
Expand Down Expand Up @@ -315,7 +327,9 @@ The `companies` command allows you to retrieve a list of all companies in Connec
companies
```

This command has no additional fields.
Note:
- This command has no additional fields.
- This command accepts trailing inputs as long as it is separated from the command by a space.

**Successful Output**

Expand Down Expand Up @@ -358,7 +372,9 @@ The fields are:
- `INDEX` is the index of the company in the displayed company list that you want to edit. It must be a positive integer within the company.
- `r/NOTE` is the note you want to add to the company.

Note: This command deletes the existing note if it is inputted without the `r/` placeholder.
Note:
- This command deletes the existing note if it is inputted without the `r/` placeholder.
- If the `r/` placeholder is specified twice, the note following the second placeholder will be used.

**Example:**

Expand Down Expand Up @@ -456,16 +472,16 @@ The company index provided is invalid.
The `addPerson` command allows you to add new contacts to your Connectify database. Follow the format below to add contacts:

```
addPerson n/NAME p/PHONE e/EMAIL a/ADDRESS c/COMPANY pr/PRIORITY [t/TAG]
addPerson n/NAME p/PHONE e/EMAIL a/ADDRESS pr/PRIORITY [c/COMPANY] [t/TAG]
```

The fields are:
- `n/NAME` is the name of the contact.
- `p/PHONE` is the phone number of the contact.
- `e/EMAIL` is the email address of the contact.
- `a/ADDRESS` is the address of the contact.
- `c/COMPANY` is the index of the company to which the contact belongs.
- `pr/PRIORITY` is the priority level of the contact.
- `[c/COMPANY]` (optional) is the index of the company to which the contact belongs.
- `[t/TAG]` (optional) is used to categorize your contacts. Tags help organize connections efficiently.

Note: If the company index is not specified, the contact will be automatically added to the first company in the displayed company list.
Expand Down Expand Up @@ -496,9 +512,16 @@ You should be able to see the person in Connectify as shown below:

**Unsuccessful Output:**

- If the provided details are incomplete or invalid:
- If any of the compulsory placeholders such as `n/`, `p/`, `e/`, `a/` or `pr/` are missing:
```
Please provide valid contact details including name, phone, email, address, and a valid company index.
Invalid command format!
addPerson: Adds a person to the address book. Parameters: n/NAME p/PHONE e/EMAIL a/ADDRESS pr/PRIORITY [c/COMPANY_INDEX] [t/TAG]...
Example: addPerson n/John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney c/1 pr/1
```

- If all the compulsory placeholders are present but the details are missing:
```
Names should only contain alphanumeric characters and spaces, and it should not be blank
```

- If a person with the same details already exists in the address book:
Expand Down Expand Up @@ -537,10 +560,10 @@ The fields are:

**Example:**

To delete the person named John Doe at index 1, use the following command:
To delete the person named John Doe at index 1 from the company at index 1, use the following command:

```
deletePerson 1
deletePerson 1 1
```

**Successful Output:**
Expand Down Expand Up @@ -575,6 +598,11 @@ The company index provided is invalid.
The person index provided is invalid.
```

- If both the specified company and person index are invalid (larger than the number of companies and people in the displayed company and person list respectively), you will get the following error message:
```
The company index provided is invalid.
```

<a href="#table-of-contents" class="return-to-toc-link">
<span class="return-to-toc-text">Return to Table of Contents</span>
<span class="return-to-toc-icon">
Expand Down Expand Up @@ -631,17 +659,20 @@ Tags: [owesMoney][friends]
```
At least one field to edit must be provided.
```

- If the specified index is missing or is not a positive integer, you will get the following error message:
```
Invalid command format!
editPerson: Edits the details of the person identified by the index number used in the displayed person list. Existing values will be overwritten by the input values.
Parameters: INDEX (must be a positive integer within the company) [c/COMPANY] [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [r/NOTE] [pr/PRIORITY] [t/TAG].
Example: editPerson 1 c/1 p/91234567 e/[email protected]
```

- If the specified index is invalid (larger than the number of companies in the displayed company list), you will get the following error message:
```
The person index provided is invalid.
```

- If the specified company index is missing, you will get the following error message:
```
No company provided.
Expand All @@ -652,8 +683,6 @@ No company provided.
The company index provided is invalid.
```

```
- If you try to edit a person's details to match another person in the address book, you will receive the following error message:
```
This person already exists in the Connectify.
Expand All @@ -679,7 +708,9 @@ The `people` command allows you to retrieve a list of all individuals (persons)
people
```

Note: This command has no additional fields.
Note:
- This command has no additional fields.
- This command accepts trailing inputs as long as it is separated from the command by a space.

**Successful Output**

Expand Down Expand Up @@ -723,7 +754,9 @@ The fields are:
- `PERSON_INDEX` is the index of the person in the displayed person list of a company that you want to edit. It must be a positive integer within the company.
- `r/NOTE` is the note you want to add to the person.

Note: This command deletes the existing note if it is inputted without the `r/` placeholder.
Note:
- This command deletes the existing note if it is inputted without the `r/` placeholder.
- If the `r/` placeholder is specified twice, the note following the second placeholder will be used.

**Example:**

Expand Down Expand Up @@ -885,7 +918,9 @@ Follow the format below to list all entities:
list
```

Note: This command has no additional fields.
Note:
- This command has no additional fields.
- This command accepts trailing inputs as long as it is separated from the command by a space.

**Successful Output**

Expand Down
41 changes: 34 additions & 7 deletions docs/team/geraldngjx.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,56 @@ Connectify is a networking platform designed to help professionals efficiently m

Given below are my contributions to the project.

* **New Feature**: To be added soon.
* **New Feature**: Created Skeleton for Company Class
* Created the skeleton code for the Company class, which serves as a fundamental component for managing company-related information.
* Added test cases for the Company class to set the project's direction.
* Significance: Utilized parameters of type String to set the groundwork for future refactoring of the Company class according to OOP principles. Refactoring of the Company class was based off the skeleton code and test cases.

* **Code contributed**: [RepoSense link]()
* **New Feature**: Implemented PersonList Object
* Introduced the PersonList object, following Object-Oriented Programming principles to enable companies to maintain a list of people associated with them.
* Significance: The PersonList object is a fundamental component of the project, as it allows the Company class to store contacts associated with it. The PersonList object is also a key component of the Company class, which is a fundamental component of the project.

* **New Feature**: Implemented `notePerson` Command
* Implemented the `notePerson` command, enabling users to add notes to their contacts.
* This feature allows users to store additional information about individuals, which is crucial in effective network management.
* Key contributions: Enhanced the platform's capabilities for user data organization and personalized interactions.

* **New Feature**: Implemented `noteCompany` Command
* Developed the `noteCompany` command, allowing users to add notes to their company contacts.
* This feature facilitates the storage of critical information about companies, which is invaluable in network management.
* Significance: Enhanced the platform's utility for managing professional relationships with organizations.

* **New Feature**: Implemented `editCompany` Command
* Implemented the `editCompany` command, enabling users to edit the details of their company contacts.
* This feature allows users to update the information of their company contacts, which is crucial in network management.
* Significance: Enables user to keep their company contacts up-to-date, which is crucial in network management.

* **Code contributed**: [RepoSense link](https://nus-cs2103-ay2324s1.github.io/tp-dashboard/?search=T15-4&sort=groupTitle&sortWithin=title&timeframe=commit&mergegroup=&groupSelect=groupByRepos&breakdown=true&checkedFileTypes=docs~functional-code~test-code&since=2023-09-22&tabOpen=true&tabType=authorship&tabAuthor=geraldngjx&tabRepo=AY2324S1-CS2103T-T15-4%2Ftp%5Bmaster%5D&authorshipIsMergeGroup=false&authorshipFileTypes=docs~functional-code~test-code&authorshipIsBinaryFileTypeChecked=false&authorshipIsIgnoredFilesChecked=false)

* **Project management**:
* To be added soon.
* Managed deliverables consistently from `v1.1` to `v1.4`.

* **Enhancements to existing features**:
* To be added soon.

* **Documentation**:
* User Guide:
* To be added soon.
* Contributed significantly to the User Guide, covering the Quick-Start, Tutorial: Adding Your First Connection, Table of Contents, and the majority of the User Guide to create the initial draft used in the PE-D practical.
* Updated documentation for User Guide to clarify expected behavior for `addPerson`, `deletePerson`, `notePerson`, and `noteCompany` commands in the first iteration of bug fixes after PE-D.
* Developer Guide:
* Updated the target user profile, value proposition and user stories. [\#12]()
* Provide use cases for a few representative features that require multiple steps to complete. [\#14]()
* Included some non-functional requirements (NFRs). [\#15]()
* Define some terms in the Glossary. [\#16]()
* Updated the implementation details of the addPerson command.
* Added the activity diagram and object diagram for the addPerson command.

* **Community**:
* To be added soon.
* **Team-Based Tasks**:
* **Established the Project Notes Google Drive**: Set up a Google Drive dedicated to Project Notes, facilitating streamlined team collaboration and centralized project documentation. Play a significant role in maintaining the document and made most of the changing including features demo in every iteration.
* **Enhanced Code Robustness through Gradle Assertions**: Implemented assertions in Gradle to bolster code robustness, contributing to the software's overall reliability.

* **Tools**:
* To be added soon.
* **Proficiently Managed SourceTree, Git, and GitHub for Version Control**: Skillfully utilized SourceTree, Git, and GitHub for revision control and code management, ensuring efficient and organized development workflows.
* **Leveraged PlantUML for Diagram Creation**: Utilized PlantUML to generate diagrams for the Developer Guide, enriching the quality of documentation and making it more visually informative.

* _{you can add/remove categories in the list above}_
2 changes: 1 addition & 1 deletion src/main/java/connectify/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static String format(Person person) {
.append(person.getAddress())
.append("; Note: ")
.append(person.getNote())
.append("Priority: ")
.append("; Priority: ")
.append(person.getPriority())
.append("; Company: ");
if (person.getParentCompany() != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/connectify/logic/commands/AddPersonCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public class AddPersonCommand extends Command {
+ PREFIX_PHONE + "PHONE "
+ PREFIX_EMAIL + "EMAIL "
+ PREFIX_ADDRESS + "ADDRESS "
+ PREFIX_PRIORITY + "PRIORITY "
+ "[" + PREFIX_COMPANY + "COMPANY_INDEX] "
+ "[" + PREFIX_TAG + "TAG]...\n"
+ "[" + PREFIX_COMPANY + "COMPANY_INDEX]...\n"
+ "[" + PREFIX_PRIORITY + "PRIORITY]...\n"
+ "Example: " + COMMAND_WORD + " "
+ PREFIX_NAME + "John Doe "
+ PREFIX_PHONE + "98765432 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public CommandResult execute(Model model) throws CommandException {
*/
private String generateSuccessMessage(Company companyToEdit) {
String message = !note.getContent().isEmpty() ? MESSAGE_ADD_NOTE_SUCCESS : MESSAGE_DELETE_NOTE_SUCCESS;
return String.format(message, companyToEdit);
return String.format(message, Messages.format(companyToEdit));
}
@Override
public boolean equals(Object other) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public CommandResult execute(Model model) throws CommandException {
*/
private String generateSuccessMessage(Person personToEdit) {
String message = !note.getContent().isEmpty() ? MESSAGE_ADD_NOTE_SUCCESS : MESSAGE_DELETE_NOTE_SUCCESS;
return String.format(message, personToEdit);
return String.format(message, Messages.format(personToEdit));
}

@Override
Expand Down
31 changes: 16 additions & 15 deletions src/test/java/connectify/logic/commands/CompanyNoteCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,43 +24,44 @@ public class CompanyNoteCommandTest {
private Model model = new ModelManager(getTypicalAddressBook(), new UserPrefs());

@Test
public void execute_addNoteUnfilteredList_success() {
Company firstCompany = model.getFilteredCompanyList().get(INDEX_FIRST_COMPANY.getZeroBased());
Company editedCompany = new CompanyBuilder(firstCompany).withNote(NOTE_STUB).build();
public void execute_addNote_success() {
Company companyWithoutNote = model.getFilteredCompanyList().get(INDEX_FIRST_COMPANY.getZeroBased());
Company editedCompanyWithNote = new CompanyBuilder(companyWithoutNote).withNote(NOTE_STUB).build();

CompanyNoteCommand companyNoteCommand = new CompanyNoteCommand(INDEX_FIRST_COMPANY,
new CompanyNote(editedCompany.getNote().getContent()));
new CompanyNote(editedCompanyWithNote.getNote().getContent()));

String expectedMessage = String.format(CompanyNoteCommand.MESSAGE_ADD_NOTE_SUCCESS, editedCompany);
String expectedMessage = String.format(CompanyNoteCommand.MESSAGE_ADD_NOTE_SUCCESS,
Messages.format(editedCompanyWithNote));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setCompany(firstCompany, editedCompany);
expectedModel.setCompany(companyWithoutNote, editedCompanyWithNote);

assertCommandSuccess(companyNoteCommand, model, expectedMessage, expectedModel);
}

@Test
public void execute_deleteNoteUnfilteredList_success() {
Company firstCompany = model.getFilteredCompanyList().get(INDEX_FIRST_COMPANY.getZeroBased());
Company editedCompany = new CompanyBuilder(firstCompany).withNote("").build();
public void execute_deleteNote_success() {
Company companyWithoutNote = model.getFilteredCompanyList().get(INDEX_FIRST_COMPANY.getZeroBased());
Company editedCompanyWithNote = new CompanyBuilder(companyWithoutNote).withNote(NOTE_STUB).build();

CompanyNoteCommand companyNoteCommand = new CompanyNoteCommand(INDEX_FIRST_COMPANY,
new CompanyNote(editedCompany.getNote().toString()));
new CompanyNote("")); // Empty note to delete note from selected company

String expectedMessage = String.format(CompanyNoteCommand.MESSAGE_DELETE_NOTE_SUCCESS, editedCompany);
String expectedMessage = String.format(CompanyNoteCommand.MESSAGE_DELETE_NOTE_SUCCESS,
Messages.format(companyWithoutNote));

Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setCompany(firstCompany, editedCompany);
model.setCompany(companyWithoutNote, editedCompanyWithNote);

assertCommandSuccess(companyNoteCommand, model, expectedMessage, expectedModel);
}

@Test
public void execute_invalidCompanyIndexUnfilteredList_failure() {
public void execute_invalidCompanyIndex_failure() {
Index outOfBoundIndex = Index.fromOneBased(model.getFilteredCompanyList().size() + 1);
CompanyNoteCommand companyNoteCommand = new CompanyNoteCommand(outOfBoundIndex,
new CompanyNote(
""));
new CompanyNote(""));

CommandTestUtil.assertCommandFailure(companyNoteCommand, model,
Messages.MESSAGE_INVALID_COMPANY_DISPLAYED_INDEX);
Expand Down
Loading

0 comments on commit f37ba3a

Please sign in to comment.