-
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 edit journal #135
Add edit journal #135
Conversation
Codecov Report
@@ Coverage Diff @@
## master #135 +/- ##
============================================
+ Coverage 66.04% 68.39% +2.35%
- Complexity 613 649 +36
============================================
Files 104 106 +2
Lines 2188 2329 +141
Branches 232 258 +26
============================================
+ Hits 1445 1593 +148
+ Misses 648 638 -10
- Partials 95 98 +3
Continue to review full report at Codecov.
|
Should be ready for merging now. There's still some tests that haven't been updated for AddJournalEntryCommand and its parser, but I'll leave that for another PR. |
public static Title parseTitle(String title) throws ParseException { | ||
requireNonNull(title); | ||
String trimmedTitle = title.trim(); | ||
if (!Title.isValidTitle(trimmedTitle)) { | ||
throw new ParseException(Title.MESSAGE_CONSTRAINTS); | ||
} | ||
return new Title(trimmedTitle); |
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.
This is a new method that replaces the old new Title(parseName(name).get())
, since the ParseException from that throws the message constraints from Name rather than Title.
Email.EMPTY_EMAIL, | ||
Address.EMPTY_ADDRESS, | ||
new HashSet<>(), | ||
UUID.fromString("e26616c9-c740-4d86-861e-733a4d377a3e") |
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.
The UUID here just uses the one from Alice Pauline in the typical persons addressbook.
It's just a placeholder that doesn't actually get used anywhere.
public static final String CONTACT_DEFAULT_UUID = "e26616c9-c740-4d86" | ||
+ "-861e-733a4d377a3e"; |
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.
This is the same UUID as used in ParserUtil's parseContacts. Again, it's just a placeholder that's used to make sure the equals method doesn't just break.
docs/DeveloperGuide.md
Outdated
|
||
#### Current Implementation | ||
|
||
Similar to the existing `editc` and `addj` commands, the `EditJournalEntryParser` makes use of `ParserUtils` to split up user input into arguments, which are then used to create an `EditEntryDescriptor` that contains the details of the journal properties to be edited. |
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.
Should just be ParserUtil
### Editing a contact: `editc` | ||
|
||
Edits an existing person in the address book. | ||
|
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.
Add aliases here
### Editing a journal entry: `editj` | ||
|
||
Edits an existing entry in the journal. | ||
|
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.
And here
Bug: EditEntryDescriptor's getContacts method throws an InvocationTargetException.
Note that the current implementation of the toString method is not properly formatted, and merely uses the verbose toString method of Person.
Bugs that have not been fixed: * Entry titles are allowed to be empty * Empty title entries are not shown properly in the UI * EditJournalEntryCommandParser does not reject usage with no arguments
Bug with testability: The contacts generated within the journal parsers each have their own UUIDs, which cannot be tested for by comparing the resulting command with another expected command. Suggested fix: Change the parseContacts method to return a list of name Strings rather than Persons.
parseContact now intialises each Person with the specified Name field and each field's empty constant and uses a constant UUID. Although the UUID used is the same as one of the test Persons, it should not pose any problems as only the Name field of the resulting Persons is used.
4f0cc90
to
278b9d8
Compare
Not ready to merge, as I have yet to write tests for this.
Had to modify the toString() method of Entry in logic to have it show that contacts were being edited, but it's not very pretty and will probably have to be rewritten soon.
Storage and UI are also missing contact representation, so contacts aren't saved to the json file orshown in Entry.