Open
Conversation
dansch
requested changes
Sep 29, 2022
Member
dansch
left a comment
There was a problem hiding this comment.
While technically everything works from my point of view, I left some change hints regarding the new method. Maybe restructuring it would make it a bit easier to understand.
Also, can we enhance the unit test for this change?
Comment on lines
+48
to
+50
| attributes[:additional_data] = get_additional_data(subject, attributes[:additional_data]) | ||
| if attributes[:additional_data] && attributes[:additional_data].key?(:member_id) | ||
| attributes[:additional_data] = Hash(attributes[:additional_data]).merge(get_additional_data(subject.member, attributes[:additional_data])) |
Member
There was a problem hiding this comment.
Some things:
- I find this method call a bit misleading, I'd rather call it
set_additional_data. - I'd move this entire additional_data definition in
set_additional_datamethod or even include the additional_data setting in this method. These are class methods, it's weird having those mixed in the private section of this class.
|
|
||
| private | ||
|
|
||
| def self.get_additional_data(subject, additional_data) |
Member
There was a problem hiding this comment.
See my comment above regarding naming and content of this method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
shot2022-09-29.at.07.18.08.mp4