<commit_before>require 'faker'

task :env_checker do
  unless Rails.env.development?
    puts "Not in development environment, exiting!"
    exit 1
  end
end

namespace :db do
  desc "Fill database with sample data"
  task :populate => [:environment, :env_checker] do
    25.times do |n|
      username = Faker::Internet.user_name(Faker::Name.first_name + "_" + Faker::Name.last_name)
      email = Faker::Internet.email(username)
      password = Faker::Internet.password(8, 18)
      User.create!(:name => username,
                   :email => email,
                   :password => password)
    end
    puts "Users populated"

    25.times do |n|
      name = Faker::Hacker.noun + " " + Faker::Hacker.verb
      name.capitalize!

      # Randomly generated word count value
      description = Faker::Lorem.sentence(rand(5...25))
      user = User.order('random()').first.name

      Franchise.create!(:name => name,
                        :description => description)
    end
    puts "Franchises populated"
  end
end<commit_msg>No idea why I can't get a user associated with a franchise<commit_after>require 'faker'

task :env_checker do
  unless Rails.env.development?
    puts "Not in development environment, exiting!"
    exit 1
  end
end

namespace :db do
  desc "Fill database with sample data"
  task :populate => [:environment, :env_checker] do
    25.times do |n|
      username = Faker::Internet.user_name(Faker::Name.first_name + "_" + Faker::Name.last_name)
      email = Faker::Internet.email(username)
      password = <PASSWORD>::<PASSWORD>.password(8, 18)
      User.create!(:name => username,
                   :email => email,
                   :password => password)
    end
    puts "Users populated"

    25.times do |n|
      name = Faker::Hacker.noun + " " + Faker::Hacker.verb
      name.capitalize!

      # Randomly generated word count value
      description = Faker::Lorem.sentence(rand(5...25))

      # Randomly chosen user
      user = User.order('random()').first

      Franchise.create!(:name => name,
                        :description => description)
    end

    puts "Franchises populated"

  end
end
{'fraction_non_alphanumeric': 0.11761971176197118, 'fraction_numerical': 0.010227801022780102, 'mean_word_length': 2.5986622073578594, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '320411', 'n_tokens_mistral': 684, 'n_tokens_neox': 642, 'n_words': 169}