Skip to content

Conversation

@elalemanyo
Copy link
Member

@elalemanyo elalemanyo commented Sep 17, 2022

shot2022-09-29.at.07.18.08.mp4

@elalemanyo elalemanyo requested a review from dansch September 17, 2022 19:44
Copy link
Member

@dansch dansch left a comment

Choose a reason for hiding this comment

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

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]))
Copy link
Member

Choose a reason for hiding this comment

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

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_data method 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)
Copy link
Member

Choose a reason for hiding this comment

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

See my comment above regarding naming and content of this method.

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.

3 participants