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

Update EditCommand.java and Person.java #81

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

Hwww23
Copy link

@Hwww23 Hwww23 commented Apr 3, 2024

Resolve a bug where not editing datetime will cause the edit function to stop working properly.

Include new method isSameDateTime to check if other person has the
same datetime
Copy link

codecov bot commented Apr 3, 2024

Codecov Report

Attention: Patch coverage is 40.00000% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 72.39%. Comparing base (1ca59b0) to head (761820b).

Files Patch % Lines
...c/main/java/seedu/address/model/person/Person.java 25.00% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #81      +/-   ##
============================================
- Coverage     72.49%   72.39%   -0.11%     
- Complexity      531      534       +3     
============================================
  Files            83       83              
  Lines          1818     1822       +4     
  Branches        189      191       +2     
============================================
+ Hits           1318     1319       +1     
- Misses          457      458       +1     
- Partials         43       45       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -99,7 +99,7 @@ public CommandResult execute(Model model) throws CommandException {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
}

if (model.hasDateTime(editedPerson)) {
if (!personToEdit.isSameDateTime(editedPerson) && model.hasDateTime(editedPerson)) {

Choose a reason for hiding this comment

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

Nice catch!

/**
* Returns true if both persons have the same set of datetime.
*/
public boolean isSameDateTime(Person otherPerson) {

Choose a reason for hiding this comment

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

Nice addition of this method, Logic is well handled. Good job!

@zoebelle-pang zoebelle-pang merged commit 48d74e5 into AY2324S2-CS2103-F15-2:master Apr 3, 2024
3 of 5 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.

2 participants