<commit_before>puts 'Seeds: start'
perform_deliveries_from_config = ActionMailer::Base.perform_deliveries
ActionMailer::Base.perform_deliveries = false

puts 'Cleaning the database...'

Reservation.destroy_all
ScheduleItem.destroy_all
Trainer.destroy_all
Room.destroy_all
FitnessClass.destroy_all
User.destroy_all
Configurable.destroy_all

Rails.cache.clear

puts 'Creating trainers...'

trainers = 6.times.with_object([]) do |n, trainers|
  trainers << {
    first_name: Faker::Name.first_name,
    last_name: Faker::Name.last_name,
    description: Faker::Lorem.paragraph(6)
  }
end

trainers = Trainer.create!(trainers)

fitness_hall = Room.create!(
  name: 'Fitness Hall',
  description: Faker::Lorem.paragraph(3)
)

spinning_room = Room.create!(
  name: 'Spinning Room',
  description: Faker::Lorem.paragraph(3)
)

puts 'Creating rooms...'

3.times do |n|
  RoomPhoto.create!(
    room: fitness_hall,
    photo: File.open(Rails.root.join('app', 'assets', 'images', "fitness#{ n }.jpg"))
  )
end

3.times do |n|
  RoomPhoto.create!(
    room: spinning_room,
    photo: File.open(Rails.root.join('app', 'assets', 'images', "fitness#{ n }.jpg"))
  )
end

fitness_classes_names_and_colors = [
  { name: 'Step', color: '#ff9000'},
  { name: 'ABT', color: '#cf2580'},
  { name: 'TBC', color: '#7835a2'},
  { name: 'HIIT', color: '#71360b'},
  { name: 'Zumba', color: '#ef2222'},
  { name: 'Pilates', color: '#12ae28'}
]

spinning_classes_names_and_colors = [
  { name: 'Spinning Basic', color: '#1a84f1'},
  { name: 'Spinning Strength', color: '#2b36a1'},
]

puts 'Creating classes...'

fitness_classes =
  fitness_classes_names_and_colors.each_with_object([]) do |fitness_class, classes|
    classes << FitnessClass.create!(
      name: fitness_class[:name],
      description: Faker::Lorem.paragraph(3),
      color: fitness_class[:color]<commit_msg>Update seeds to work with Heroku/Carrierwave<commit_after>puts 'Seeds: start'
perform_deliveries_from_config = ActionMailer::Base.perform_deliveries
ActionMailer::Base.perform_deliveries = false

puts 'Cleaning the database...'

Reservation.destroy_all
ScheduleItem.destroy_all
Trainer.destroy_all
Room.destroy_all
FitnessClass.destroy_all
User.destroy_all
Configurable.destroy_all

Rails.cache.clear

puts 'Creating trainers...'

trainers = 6.times.with_object([]) do |n, trainers|
  trainers << {
    first_name: Faker::Name.first_name,
    last_name: Faker::Name.last_name,
    description: Faker::Lorem.paragraph(6)
  }
end

trainers = Trainer.create!(trainers)

fitness_hall = Room.create!(
  name: 'Fitness Hall',
  description: Faker::Lorem.paragraph(3)
)

spinning_room = Room.create!(
  name: 'Spinning Room',
  description: Faker::Lorem.paragraph(3)
)

puts 'Creating rooms...'

3.times do |n|
  photo = File.open(Rails.root.join('app', 'assets', 'images', "fitness#{ n }.jpg"))

  RoomPhoto.create!(
    room: fitness_hall,
    photo: photo
  )

  photo.close
end

3.times do |n|
  photo = File.open(Rails.root.join('app', 'assets', 'images', "fitness#{ n }.jpg"))

  RoomPhoto.create!(
    room: spinning_room,
    photo: photo
  )

  photo.close
end

fitness_classes_names_and_colors = [
  { name: 'Step', color: '#ff9000'},
  { name: 'ABT', color: '#cf2580'},
  { name: 'TBC', color: '#7835a2'},
  { name: 'HIIT', color: '#71360b'},
  { name: 'Zumba', color: '#ef2222'},
  { name: 'Pilates', color: '#12ae28'}
]

spinning_classes_names_and_colors = [
  { name: 'Spinning Basic', color: '#1a84f1'},
  { name: 'Spinning Strength', color: '#2b36a1'},
]

puts 'Creating classes...'

fitness_classes =
  fitness_classes_names_and_colors.each_with_object([]) do |fitness_class, classes|
    classes << FitnessClass.create!(
      name: fitness_class[:name],
      description: Faker::Lorem.paragraph(3),
      color: fitness_class[:color]
{'fraction_non_alphanumeric': 0.15670265999473268, 'fraction_numerical': 0.021595996839610217, 'mean_word_length': 4.798473282442748, 'pattern_counts': {'":': 0, '<': 11, '<?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': '703105', 'n_tokens_mistral': 1428, 'n_tokens_neox': 1379, 'n_words': 278}