-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
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.
There was a problem hiding this 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; |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
There was a problem hiding this 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 | ||
*/ |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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!
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 aschecks for equality.
Refactoring
Person::equals
method to usePerson::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.