<commit_before># This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).

def save_or_update_model(model, search_options, attributes)
  object = model.find_or_create_by(search_options)
  object.attributes = attributes
  object.save

  object
end

def create_default_admin_user
  puts '####################'
  puts '## Creating default admin user'
  puts '####################'

  admin = AdminUser.find_by(:email => '<EMAIL>')
  if admin.nil?
    AdminUser.create!(:email => '<EMAIL>',
                      :password => 'password',
                      :password_confirmation => 'password')
  end

  puts '####################'
  puts '## Creating default user'
  puts '####################'

  customer = Customer.find_by(:email => '<EMAIL>')
  if customer.nil?
    Customer.create!(:email => '<EMAIL>',
                      :name => '<NAME>',
                      :last_name => 'User last_name',
                      :birth_date => DateTime.now,
                      :password => 'password',
                      :locale => 'en',
                      :password_confirmation => 'password')
  end
end

def create_default_languages
  puts '####################'
  puts '## Creating default languages'
  puts '####################'<commit_msg>Fixed create emails.<commit_after># This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).

def save_or_update_model(model, search_options, attributes)
  object = model.find_or_create_by(search_options)
  object.attributes = attributes
  object.save

  object
end

def create_default_admin_user
  puts '####################'
  puts '## Creating default admin user'
  puts '####################'

  admin = AdminUser.find_by(:email => '<EMAIL>')
  if admin.nil?
    AdminUser.create!(:email => '<EMAIL>',
                      :password => 'password',
                      :password_confirmation => 'password')
  end

  puts '####################'
  puts '## Creating default user'
  puts '####################'

  customer = Customer.find_by(:email => '<EMAIL>')
  if customer.nil?
    Customer.create!(:email => '<EMAIL>',
                      :name => '<NAME>',
                      :last_name => 'User last_name',
                      :birth_date => DateTime.now,
                      :password => 'password',
                      :locale => 'en',
                      :password_confirmation => 'password')
  end
end

def create_default_languages
  puts '####################'
  puts '## Creating default languages'
  puts '####################'
{'fraction_non_alphanumeric': 0.18882121103547117, 'fraction_numerical': 0.0, 'mean_word_length': 2.7628032345013476, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 37, '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': '4754780', 'n_tokens_mistral': 751, 'n_tokens_neox': 742, 'n_words': 208}