<commit_before>namespace :fake_quiz_data do

  desc "Generate fake data to populate 4 quizzes"

  task :populate_quizzes => :environment do

    # generate 3 user
    3.times do 
      user = User.create(name: Faker::Internet.password(7), email: Faker::Internet.email, password: <PASSWORD>.password(8), admin: [true, false].sample, activated: true )
    end

    # generate 2 category
    2.times do
      category = Category.create(title: Faker::Lorem.word)
    end

    # generate 3 quiz for each category
    Category.all.each do |c|
      3.times do
        quiz = c.quizzes.create(title: Faker::Company.bs, body: Faker::Lorem.sentence(10), level: [1, 2, 3].sample, category_id: Category.all.sample.id)
      end
    end

    # generate 10 questions for each quiz
  
    Quiz.all.each do |quiz|
      10.times do 
        question = quiz.questions.create(title: Faker::Lorem.word, body: Faker::Lorem.sentence(15), explaination: Faker::Lorem.sentence(10) )
      end
    end


    # generate 3 answers for each question
    Question.all.each do |question|<commit_msg>change fake_quiz_data to match new DB naming<commit_after>namespace :fake_quiz_data do

  desc "Generate fake data to populate 4 quizzes"

  task :populate_quizzes => :environment do

    # generate 3 user
    3.times do 
      user = User.create(name: Faker::Internet.password(7), email: Faker::Internet.email, password: <PASSWORD>(8), admin: [true, false].sample, activated: true )
    end

    # generate 2 category
    2.times do
      category = Category.create(title: Faker::Lorem.word)
    end

    # generate 3 quiz for each category
    Category.all.each do |c|
      3.times do
        quiz = c.quizzes.create(title: Faker::Company.bs, body: Faker::Lorem.sentence(10), level: [1, 2, 3].sample, category_id: Category.all.sample.id)
      end
    end

    # generate 10 questions for each quiz
  
    Quiz.all.each do |quiz|
      10.times do 
        question = quiz.questions.create(title: Faker::Lorem.word, body: Faker::Lorem.sentence(15), explanation: Faker::Lorem.sentence(10) )
      end
    end


    # generate 3 answers for each question
    Question.all.each do |question|
{'fraction_non_alphanumeric': 0.1105969458583989, 'fraction_numerical': 0.02128644146228598, 'mean_word_length': 3.0946969696969697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5298570', 'n_tokens_mistral': 746, 'n_tokens_neox': 677, 'n_words': 195}