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 status attribute + other minor fixes #108

Merged
merged 15 commits into from
Oct 23, 2024

Conversation

ZShunRen
Copy link

@ZShunRen ZShunRen commented Oct 21, 2024

There is no way to indicate if follow-up action is needed for a
particular customer, which is usually the case with financial services.

Adding the status attribute helps the user differentiate between clients
who may need follow-up action, and works in tandem with remark, where
case details can be inserted.

Other small changes include:

  • Refactoring Person::isSamePerson method to use name, phone and email as
    checks for equality.

  • Refactoring Person::equals method to use Person::isSamePerson
    method when checking for equality, which makes the code more
    maintainable as equality logic is only specified once.

  • Added more tests into AddCommandParser.java to test the new flags like income, etc.

  • Refactoring one of the tests in AddCommandParserTest which used a normal set, which did not preserve the order of duplicates, to a linked set which preserves order.

    Closes Add status attribute #116.

ZShunRen and others added 7 commits October 21, 2024 12:53
Remove status which will be added in another PR.
There is no way to indicate if follow-up action is needed for a
particular customer, which is usually the case with financial services.

Adding the status attribute helps the user differentiate between clients
who may need follow-up action, and works in tandem with remark, where
case details can be inserted.

Other small changes include:
- Refactoring `Person::isSamePerson` method to use name, phone and email as
  checks for equality.
- Refactoring `Person::equals` method to use `Person::isSamePerson`
  method when checking for equality, which makes the code more
  maintainable as equality logic is only specified once.
@ZShunRen ZShunRen changed the title Status dev Add status attribute + other minor fixes Oct 21, 2024
Copy link

@FionaQY FionaQY left a comment

Choose a reason for hiding this comment

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

LGTM. Though I'm not sure if JsonAdaptedStatus/JsonAdaptedTier is needed given that a person can have at most one of which.

I'm also not sure if Status should be its own status package either (though the same can be said for Tier)

@@ -39,7 +40,9 @@ public class PersonCard extends UiPart<Region> {
@FXML
private Label remark;
@FXML
private FlowPane assignedTier;
private FlowPane assignedStatus;
Copy link

Choose a reason for hiding this comment

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

Is there a need for both assignedStatus and assignedStatusAndTier ?

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for spotting this, I have amended it accordingly.

src/main/java/seedu/address/storage/JsonAdaptedStatus.java Outdated Show resolved Hide resolved
src/main/java/seedu/address/storage/JsonAdaptedStatus.java Outdated Show resolved Hide resolved
@ZShunRen ZShunRen added this to the v1.4 milestone Oct 21, 2024
@ZShunRen ZShunRen mentioned this pull request Oct 22, 2024
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.

Nice work overall! Great catch and change regarding the iincorrect plural form for Tier.

src/main/java/seedu/address/storage/JsonAdaptedStatus.java Outdated Show resolved Hide resolved
src/main/java/seedu/address/ui/PersonCard.java Outdated Show resolved Hide resolved
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.

LGTM! Solid work for our new function status! Further improvement or supplement to this can be more test specifically on status, but for now the testing protocol for status under related command should be enough to cover most cases now. 🤩

* Returns true if a given string is a valid status value.
*
* @param test The string to be tested
*/

Choose a reason for hiding this comment

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

Would be better to have @return tag in the Javadoc comment and explaination of what boolean return value means :D

Copy link
Author

Choose a reason for hiding this comment

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

Hi I have added this, thank you pleng.

}

/**
* Represent what values Status can take.

Choose a reason for hiding this comment

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

Consider moving the enum to its own file if it might need to be referenced independently 👍🏻 This can be applied to other enums in our project too!

Copy link
Author

Choose a reason for hiding this comment

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

I think for now since the enum is related to Status, we can keep it here, but we can possibly refactor the enums to CommandCommons to reduce coupling in the future.

}

@Override
public int hashCode() {

Choose a reason for hiding this comment

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

Good that you don't forget to override hash code! :D

/**
* Converts a given {@code Status} into a {@code JsonAdaptedStatus} for Jackson use.
*/
public JsonAdaptedStatus(Status source) {

Choose a reason for hiding this comment

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

Consider adding null check for source parameter!

Copy link
Author

Choose a reason for hiding this comment

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

Hi, will add the requirenonnull check!

Person validPerson = new PersonBuilder().withTier("GOLD").withRemark("big brained").build();
public void execute_newPersonWithTierAndRemarkAndStatus_success() {
Person validPerson =
new PersonBuilder().withTier("GOLD").withRemark("big brained").withStatus("urgent").build();

Choose a reason for hiding this comment

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

Good that you not forget to test the status attributes in person!

@ZShunRen ZShunRen merged commit d482979 into AY2425S1-CS2103T-T14-4:master Oct 23, 2024
3 checks passed
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.

Add status attribute
4 participants