-
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
Update editCommand and deleteCommand logic #131
Update editCommand and deleteCommand logic #131
Conversation
so that it preserves UUID of editedPerson
Codecov ReportAttention: Patch coverage is
|
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.
LGTM!
if (volunteers.contains(personToEdit)) { | ||
volunteers.remove(personToEdit); | ||
volunteers.add(editedPerson); | ||
} |
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.
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
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.
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
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.
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) { |
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.
Looks good, so deleting a person will remove them entirely
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.
LGTM! Sound implementation of delete and edit applied to events
if (volunteers.contains(personToEdit)) { | ||
volunteers.remove(personToEdit); | ||
volunteers.add(editedPerson); | ||
} |
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.
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
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.