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 and deleteCommand logic #131

Merged

Conversation

shardhrv
Copy link
Collaborator

@shardhrv shardhrv commented Oct 29, 2024

Updated the logic for these commands execution, as it no longer makes sense to store UUID in EventStorage over the Person themselves. This is because the latter would require a major rework of the current implementation of the interactions between ModelManager and EventManager.

Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 27.27273% with 24 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/main/java/seedu/address/model/event/Event.java 0.00% 24 Missing ⚠️
Files with missing lines Coverage Δ Complexity Δ
...logic/commands/contact/commands/DeleteCommand.java 100.00% <100.00%> (ø) 7.00 <0.00> (ø)
...s/logic/commands/contact/commands/EditCommand.java 97.77% <100.00%> (+0.05%) 14.00 <0.00> (ø)
...n/java/seedu/address/model/event/EventManager.java 100.00% <100.00%> (ø) 14.00 <2.00> (+2.00)
src/main/java/seedu/address/model/event/Event.java 70.19% <0.00%> (-21.06%) 33.00 <0.00> (ø)

... and 1 file with indirect coverage changes

@shardhrv shardhrv requested review from chuajunyu and jan-kai1 and removed request for chuajunyu October 29, 2024 15:28
Copy link
Collaborator

@chuajunyu chuajunyu left a comment

Choose a reason for hiding this comment

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

LGTM!

if (volunteers.contains(personToEdit)) {
volunteers.remove(personToEdit);
volunteers.add(editedPerson);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't think of anyway better to do this rn but this does seem abit funny caz we have to check every set and add / remove, maybe we can think of something better next time

Copy link

Choose a reason for hiding this comment

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

Perhaps we could abstract out this removal and addition into a method called editPersonInRoleSet to make it more readable and less repetitive, but otherwise the implementation seems sound

Copy link
Collaborator

@jan-kai1 jan-kai1 left a comment

Choose a reason for hiding this comment

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

LGTM! May have to make changes later on based on whether we are using UUID

* Removes person from all roles if they are present in that role
* @param personToRemove Person that will be removed
*/
public void removePerson(Person personToRemove) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks good, so deleting a person will remove them entirely

Copy link

@cshao02 cshao02 left a comment

Choose a reason for hiding this comment

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

LGTM! Sound implementation of delete and edit applied to events

if (volunteers.contains(personToEdit)) {
volunteers.remove(personToEdit);
volunteers.add(editedPerson);
}
Copy link

Choose a reason for hiding this comment

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

Perhaps we could abstract out this removal and addition into a method called editPersonInRoleSet to make it more readable and less repetitive, but otherwise the implementation seems sound

@cshao02 cshao02 merged commit 3953283 into AY2425S1-CS2103T-F09-2:master Nov 3, 2024
3 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.

4 participants