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
Branch input validation #75
Branch input validation #75
Conversation
Remove policy field when adding new person
To do: should remove policy prefix
Change ListCommand to ListPeopleCommand
Not finished
Not finished
…from the edit command
To do: should remove policy prefix
Change ListCommand to ListPeopleCommand
Not finished
Not finished
…n/main into branch-input-validation # Conflicts: # docs/UserGuide.adoc # src/main/java/seedu/address/logic/commands/AddPolicyCommand.java # src/main/java/seedu/address/logic/commands/EditCommand.java # src/main/java/seedu/address/logic/parser/AddCommandParser.java # src/main/java/seedu/address/logic/parser/AddPolicyCommandParser.java # src/main/java/seedu/address/logic/parser/AddressBookParser.java # src/main/java/seedu/address/logic/parser/ParserUtil.java # src/main/java/seedu/address/model/Model.java # src/main/java/seedu/address/model/person/DateOfBirth.java # src/main/java/seedu/address/model/person/Nric.java # src/main/java/seedu/address/model/person/Person.java # src/main/java/seedu/address/model/policy/Coverage.java # src/main/java/seedu/address/model/policy/EndAge.java # src/main/java/seedu/address/model/policy/Policy.java # src/main/java/seedu/address/model/policy/Price.java # src/main/java/seedu/address/model/policy/StartAge.java # src/main/java/seedu/address/model/policy/UniquePolicyList.java # src/main/java/seedu/address/model/policy/exceptions/DuplicatePolicyException.java # src/main/java/seedu/address/model/util/SampleDataUtil.java # src/main/java/seedu/address/storage/JsonAdaptedPerson.java # src/main/java/seedu/address/storage/JsonAdaptedPolicy.java
"phone" : "98765432", | ||
"email" : "johnd@example.com", | ||
"address" : "311, Clementi Ave 2, #02-25", | ||
"tagged" : [ "owesMoney", "friends" ] | ||
"date of birth" : "12.12.1922", | ||
"policies" : [ ["SeniorCare", "SeniorCare", "months/12", "$1000" ], |
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.
Extra square bracket
"phone" : "87652533", | ||
"email" : "cornelia@example.com", | ||
"address" : "10th street", | ||
"tagged" : [ "friends" ] | ||
"date of birth" : "14.2.2019", | ||
"policies" : [ ["Infant Insurance", "Infant Insurance", "years/2", "$1500"] ], |
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.
Why is this wrapped under an extra set of square brackets?
actually im not sure how json works so idk how to the policies are supposed
to be converted to the jsonadaptedpolicy🤔
…On Sun, Oct 6, 2019 at 6:14 PM Chaitanya Baranwal ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
src/test/data/JsonSerializableAddressBookTest/typicalPersonsAddressBook.json
<#75 (comment)>
:
> "phone" : "87652533",
"email" : ***@***.***",
"address" : "10th street",
- "tagged" : [ "friends" ]
+ "date of birth" : "14.2.2019",
+ "policies" : [ ["Infant Insurance", "Infant Insurance", "years/2", "$1500"] ],
Why is this wrapped under an extra set of square brackets?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#75?email_source=notifications&email_token=AM4VMSZIU5B7URVJJ2RPV23QNG3APA5CNFSM4I5WGAL2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCHAILSQ#pullrequestreview-297829834>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AM4VMSYCXTLBSZRQI564EK3QNG3APANCNFSM4I5WGALQ>
.
|
public class Nric { | ||
|
||
public static final String MESSAGE_CONSTRAINTS = | ||
"This is not a valid Singapore Idenfication number.\n" + |
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.
Typo "Idenfication"
"Phone numbers should only contain numbers, and it should be at least 3 digits long"; | ||
public static final String VALIDATION_REGEX = "\\d{3,}"; | ||
"Phone numbers should only contain numbers, and it should be at least 3 digits long.\n"; | ||
public static final String VALIDATION_REGEX = "\\d{3,8}"; | ||
public final String value; |
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.
Maybe we can consider this phone validation regex instead? I think it suits sg context better.
wow this is alot of work! thanks so much yi yin! I didn't have much time to look through the code in detail, but I did smoke tests and they work fine (other than input validation for phone number). i'd also suggest to add |
@JsonProperty("tagged") List<JsonAdaptedTag> tagged) { | ||
this.name = name; | ||
this.description = description; | ||
this.coverage = coverage; |
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.
Yo i'm trying to fix the test cases.
Test case:toModelType_validPersonDetails_returnsPerson
In SampleDataUtil
, new Coverage(" days/10 months/11 years/12")
However in the model, coverage takes in the argument 10 days 11 months 12 years
, which leads to coverage being null as it is not able to parse the correct format using getCoverageBreakdown
.
However, is coverage meant to be doing the parsing? cuz in sample data util, the arguments are the content itself.
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.
Sup Yiyin, awesome work here! That's a monster of a pr, thanks for lifting this heavy load. I have left a few comments here and there, the ones with "Note:" are not directed towards you, they just there to note down some potential discrepancies, or raise up certain issues which we could discuss about as a group. Other than that there's one thing I want to mention:
I realised that our addperson
command allows the user to add policies and tags when creating a new contact, but editperson
does not allow that, which might be a little confusing for both the user and us. I was thinking that since we already have the commands assignpolicy
, unassignpolicy
, addtag
, deletetag
why not just separate the adding/editing of policies and tags entirely and leave that responsibility to the various commands mentioned. This means that addperson
and editperson
only touches the particulars of the contact, while anything else related to policies and tags will have their own helper commands like the ones raised above. This allows us and our users to draw a distinct line between things related to person, tags, and policies, which i think makes the user workflow simpler. The same goes for addpolicy
and editpolicy
.
I think we should discuss this, let us know what you and oli think during your meeting tonight! Thanks again :D
public static final Prefix PREFIX_PHONE = new Prefix("p/"); | ||
public static final Prefix PREFIX_EMAIL = new Prefix("e/"); | ||
public static final Prefix PREFIX_ADDRESS = new Prefix("a/"); | ||
public static final Prefix PREFIX_DATE_OF_BIRTH = new Prefix("dob/"); | ||
public static final Prefix PREFIX_POLICY = new Prefix("pol/"); | ||
public static final Prefix PREFIX_TAG = new Prefix("t/"); | ||
|
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.
Small thing, but might want to add a comment here to denote policy prefixes
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
model.addPolicy(toAdd); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, toAdd)); | ||
} |
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.
Note:
- Duplicate policy not yet implemented, also resulting in no CommandException being thrown (referencing to AddCommand.java)
@@ -8,9 +8,9 @@ | |||
/** | |||
* Lists all persons in the address book to the user. | |||
*/ | |||
public class ListCommand extends Command { | |||
public class ListPeopleCommand extends Command { |
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.
Note:
- What purpose does this command actually serve to the user, since the main page already lists all the contacts in the addressbook?
@Override | ||
public void addPolicy(Policy policy) { | ||
addressBook.addPolicy(policy); | ||
updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS); |
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.
Note:
addPolicy
should update policy list instead of person list?
Change duplicate person error
Added policy class and new fields to person.
Added addpolicycommand.
UI can now display new person fields.
Tests are incomplete (6 still failing).