<commit_before>class PopulateAvatarInitialsOnUser < ActiveRecord::Migration
  class User < ActiveRecord::Base
  end

  def up
    User.all.each do |user|
      initials = ""
      if  user.name.blank? || user.name == user.email
        initials = user.email[0..1]
      else
        user.name.gsub(/(?:^|\s|-|')[A-Z,a-z]/) { |first_character| initials += first_character }
      end
      initials = initials.upcase.gsub(/ /, '')
      initials = "DU" if user.deleted_at
      user.avatar_initials = initials[0..1]
      user.save
    end
  end

  def down
  end
end
<commit_msg>Fix migrations<commit_after>class PopulateAvatarInitialsOnUser < ActiveRecord::Migration
  class User < ActiveRecord::Base
  end

  def up
    User.reset_column_information
    User.all.each do |user|
      initials = ""
      if user.name.blank? || user.name == user.email
        initials = user.email[0..1]
      else
        user.name.split.each { |name| initials += name[0] }
      end
      initials = initials.upcase.gsub(/ /, '')
      initials = "DU" if user.deleted_at
      user.avatar_initials = initials[0..2]
      user.save!
    end
  end

  def down
  end
end

{'fraction_non_alphanumeric': 0.12554112554112554, 'fraction_numerical': 0.007792207792207792, 'mean_word_length': 2.4201183431952664, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6985940', 'n_tokens_mistral': 398, 'n_tokens_neox': 398, 'n_words': 82}