<commit_before>class Member
  include Mongoid::Document
  include Mongoid::Timestamps

  field :trello_id
  field :username
  field :full_name
  field :avatar_id
  field :bio
  field :url

  embedded_in :effort

  validates_presence_of :username

  def self.build_from(trello_member)
    trello_member_id = trello_member.id
    trello_member.attributes.delete(:id)
    new(trello_member.attributes.merge(trello_id: trello_member_id))
  end

  def at_username
    "@#{username}"
  end

  def avatar_url
    "https://trello-avatars.s3.amazonaws.com/#{avatar_id}/30.png"
  end

  def effort_spent
    cards = TrackedCard.where("efforts.members.username" => username)
    efforts = cards.map(&:efforts).compact.flatten

    efforts.select { |e| e.members.map(&:username).include?(username) }.inject(0) { |total, e| total + e.amount_per_member }
  end

  def ==(other)
    return true if other.equal?(self)
    return false unless other.kind_of?(self.class)

    username == other.username
  end

  def eql?(other)
    return false unless other.instance_of?(self.class)
    username == other.username
  end

  def hash
    username.hash
  end

end
<commit_msg>reimplementing Member#avatar_url delegating to Trello::Member<commit_after>class Member
  include Mongoid::Document
  include Mongoid::Timestamps

  field :trello_id
  field :username
  field :full_name
  field :avatar_id
  field :bio
  field :url

  embedded_in :effort

  validates_presence_of :username

  def self.build_from(trello_member)
    trello_member_id = trello_member.id
    trello_member.attributes.delete(:id)
    new(trello_member.attributes.merge(trello_id: trello_member_id))
  end

  def at_username
    "@#{username}"
  end

  def avatar_url
    trello_member.avatar_url(size: :small)
  end

  def effort_spent
    cards = TrackedCard.where("efforts.members.username" => username)
    efforts = cards.map(&:efforts).compact.flatten

    efforts.select { |e| e.members.map(&:username).include?(username) }.inject(0) { |total, e| total + e.amount_per_member }
  end

  def ==(other)
    return true if other.equal?(self)
    return false unless other.kind_of?(self.class)

    username == other.username
  end

  def eql?(other)
    return false unless other.instance_of?(self.class)
    username == other.username
  end

  def hash
    username.hash
  end

  private

  def trello_member
    @trello_member ||= Trello::Member.new("id" => trello_id, "fullName" => full_name, "username" => username,
                                           "avatarHash" => avatar_id, "bio" => bio, "url" => url)
  end

end

{'fraction_non_alphanumeric': 0.10809763657497094, 'fraction_numerical': 0.0019372336303758234, 'mean_word_length': 3.578014184397163, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3934463', 'n_tokens_mistral': 910, 'n_tokens_neox': 873, 'n_words': 184}