Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remark command #2

Conversation

ZShunRen
Copy link

@ZShunRen ZShunRen commented Sep 28, 2024

Closed in favor of #32, due to a branch renaming from AgentAssist-RemarkCommand-Dev to tutorial-adding-command.

Copy link

@iamdiluxedbutcooler iamdiluxedbutcooler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Thank you so much for your valuable efforts to the tp! :D

import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.person.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How could we rewrite the stars?

Amend constructor usage in JsonAdaptedPersonTest.java file and
JsonAdaptedPerson.java file.

As the JsonAdaptedPerson has an additional remark parameter, the lack of
this parameter in the test file's constructor calling led to an error.

Thus the constructor calls have the remark parameter specified now.
@ZShunRen ZShunRen force-pushed the AgentAssist-RemarkCommand-Dev branch from ee1a039 to 206dc1d Compare September 29, 2024 17:33
import seedu.address.model.person.Remark;


import java.util.List;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not resolve yet sorry. The import java.* should be placed before other import seedu.*.

import seedu.address.model.person.Person;
import seedu.address.model.person.Remark;


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventhough having 2 blank lines is not violate the coding standard, but might ask if you wanna reduce it to one?


import static java.util.Objects.requireNonNull;
import static seedu.address.commons.util.AppUtil.checkArgument;
public class Remark {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to have one blank line before declare the class! (or because we will have JavaDocs comment here anyway)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion, will add it soon

}

@Override
public int hashCode() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice for you to override the hashCode!

@Test
public void execute_filteredList_success() {
showPersonAtIndex(model, INDEX_FIRST_PERSON);
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed we have an opportunity to streamline our setup process across multiple tests. To make the test suite more maintainable and scalable, one suggestion is to create an abstract BaseTest class that includes all the common setup code in a @beforeeach method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea actually, we can open an issue for this if the others agree. @ZShunRen @FionaQY @colinhia

Copy link

@itsme-zeix itsme-zeix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work overall! Just some nitpicks here and there that's mostly related to style.

Comment on lines 37 to 40




Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Remove extra empty lines

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;
import java.util.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import java.util.*;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

Replace wildcard import with more explicit import

import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;
import seedu.address.model.person.*;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import seedu.address.model.person.*;
import seedu.address.model.person.Address;
import seedu.address.model.person.Email;
import seedu.address.model.person.Name;
import seedu.address.model.person.Person;
import seedu.address.model.person.Phone;

Replace wildcard import with more explicit import

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wildcard has been replaced, thank you!

}

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
}

Add EOF

@@ -28,21 +29,24 @@ class JsonAdaptedPerson {
private final String phone;
private final String email;
private final String address;
private final List<JsonAdaptedTag> tags = new ArrayList<>();
private final String remark;
private final List<JsonAdaptedTag> tagged = new ArrayList<>();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would retain tags instead of renaming the variable to tagged since we are referring to a list of tags. tagged doesn't quite imply list of tags - I would infer it to be a boolean variable (although isTag better implies boolean i know)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I agree with your reasoning. I changed it because I thought the past sense made more sense, but I shall revert this change, thanks!

Comment on lines 46 to 55
public void execute_deleteRemarkUnfilteredList_success() {
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build();
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON,
new Remark(editedPerson.getRemark().toString()));
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS,
Messages.format(editedPerson));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setPerson(firstPerson, editedPerson);
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void execute_deleteRemarkUnfilteredList_success() {
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build();
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON,
new Remark(editedPerson.getRemark().toString()));
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS,
Messages.format(editedPerson));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setPerson(firstPerson, editedPerson);
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel);
public void execute_deleteRemarkUnfilteredList_success() {
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
Person editedPerson = new PersonBuilder(firstPerson).withRemark("").build();
RemarkCommand remarkCommand = new RemarkCommand(INDEX_FIRST_PERSON,
new Remark(editedPerson.getRemark().toString()));
String expectedMessage = String.format(RemarkCommand.MESSAGE_DELETE_REMARK_SUCCESS,
Messages.format(editedPerson));
Model expectedModel = new ModelManager(new AddressBook(model.getAddressBook()), new UserPrefs());
expectedModel.setPerson(firstPerson, editedPerson);
assertCommandSuccess(remarkCommand, model, expectedMessage, expectedModel);

Add new lines for better readability

@Test
public void execute_filteredList_success() {
showPersonAtIndex(model, INDEX_FIRST_PERSON);
Person firstPerson = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea actually, we can open an issue for this if the others agree. @ZShunRen @FionaQY @colinhia

@ZShunRen ZShunRen closed this Oct 3, 2024
@ZShunRen ZShunRen deleted the AgentAssist-RemarkCommand-Dev branch October 3, 2024 15:17
@ZShunRen ZShunRen mentioned this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants