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 edit journal #135

Merged
merged 42 commits into from
Oct 26, 2020

Conversation

jazerler
Copy link

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.

@codecov-io
Copy link

codecov-io commented Oct 25, 2020

Codecov Report

Merging #135 into master will increase coverage by 2.35%.
The diff coverage is 90.38%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
...java/seedu/address/logic/commands/HelpCommand.java 52.17% <0.00%> (-2.38%) 6.00 <0.00> (ø)
...edu/address/logic/parser/IntelliJournalParser.java 78.12% <50.00%> (-2.53%) 17.00 <0.00> (ø)
...edu/address/logic/commands/EditContactCommand.java 97.56% <75.00%> (ø) 12.00 <2.00> (?)
...address/logic/parser/EditContactCommandParser.java 92.30% <75.00%> (ø) 11.00 <1.00> (?)
...ddress/logic/commands/EditJournalEntryCommand.java 91.57% <91.57%> (ø) 14.00 <14.00> (?)
...ss/logic/parser/EditJournalEntryCommandParser.java 93.33% <93.33%> (ø) 10.00 <10.00> (?)
...ava/seedu/address/logic/commands/ValidCommand.java 89.47% <100.00%> (+0.28%) 7.00 <0.00> (ø)
...ess/logic/parser/AddJournalEntryCommandParser.java 88.23% <100.00%> (+0.73%) 5.00 <1.00> (ø)
...in/java/seedu/address/logic/parser/ParserUtil.java 88.00% <100.00%> (+11.18%) 30.00 <2.00> (+4.00)
src/main/java/seedu/address/model/Model.java 100.00% <100.00%> (ø) 2.00 <1.00> (+1.00)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7319c9c...eb1e074. Read the comment docs.

@jazerler jazerler marked this pull request as draft October 25, 2020 13:33
@jazerler jazerler marked this pull request as ready for review October 26, 2020 00:34
@jazerler
Copy link
Author

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.

Comment on lines +72 to +78
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);
Copy link
Author

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")
Copy link
Author

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.

Comment on lines +54 to +55
public static final String CONTACT_DEFAULT_UUID = "e26616c9-c740-4d86"
+ "-861e-733a4d377a3e";
Copy link
Author

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.


#### 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.

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.

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.

Choose a reason for hiding this comment

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

And here

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.
@joshualiangxy joshualiangxy merged commit d93f90e into AY2021S1-CS2103T-W17-4:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment