<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).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

def random_policy_text(number_of_paragraphs=3)
  @policy_data ||= File.read(File.expand_path("../seed_policy_bodies.txt", __FILE__)).split("\n")
  @policy_data.shuffle[0...number_of_paragraphs].join("\n\n")
end

alice = User.create!(name: "<NAME>")
bob = User.create!(name: "<NAME>")
clive = User.create!(name: "<NAME>")

# Draft policies
alice.editions.create! title: "Free cats for pensioners", body: random_policy_text, submitted: false
bob.editions.create! title: "Decriminalise beards", body: random_policy_text(5), submitted: false

# Submitted policies
alice.editions.create! title: "Less gravity on Sundays", body: random_policy_text, submitted: true
clive.editions.create! title: "Ducks pulling chariots of fire", body: random_policy_text(4), submitted: true

# Published policies
clive.editions.create! title: "No more supernanny", body: random_policy_text, published: true
alice.editions.create! title: "Laser eyes for millionaires", body: random_policy_text, published: true<commit_msg>Update the seed editions to all have policies.<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).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

def random_policy_text(number_of_paragraphs=3)
  @policy_data ||= File.read(File.expand_path("../seed_policy_bodies.txt", __FILE__)).split("\n")
  @policy_data.shuffle[0...number_of_paragraphs].join("\n\n")
end

alice = User.create!(name: "<NAME>")
bob = User.create!(name: "<NAME>")
clive = User.create!(name: "<NAME>")

# Draft policies
alice.editions.create! title: "Free cats for pensioners", body: random_policy_text, submitted: false, policy: Policy.new
bob.editions.create! title: "Decriminalise beards", body: random_policy_text(5), submitted: false, policy: Policy.new

# Submitted policies
alice.editions.create! title: "Less gravity on Sundays", body: random_policy_text, submitted: true, policy: Policy.new
clive.editions.create! title: "Ducks pulling chariots of fire", body: random_policy_text(4), submitted: true, policy: Policy.new

# Published policies
clive.editions.create! title: "No more supernanny", body: random_policy_text, published: true, policy: Policy.new
alice.editions.create! title: "Laser eyes for millionaires", body: random_policy_text, published: true, policy: Policy.new
{'fraction_non_alphanumeric': 0.13219393093826298, 'fraction_numerical': 0.0027903732124171608, 'mean_word_length': 6.046683046683047, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '592700', 'n_tokens_mistral': 905, 'n_tokens_neox': 891, 'n_words': 270}