<commit_before># frozen_string_literal: true
if !Rails.env.production? || ENV["SEED"]
  require "decidim/faker/localized"

  staging_organization = Decidim::Organization.create!(
    name: Faker::Company.name,
    host: ENV["DECIDIM_HOST"] || "localhost",
    welcome_text: Decidim::Faker::Localized.sentence(5),
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(15)
    end,
    homepage_image: File.new(File.join(File.dirname(__FILE__), "seeds", "homepage_image.jpg")),
    default_locale: I18n.default_locale,
    available_locales: Decidim.available_locales
  )

  3.times do
    Decidim::Scope.create!(
      name: Faker::Lorem.word,
      organization: staging_organization
    )
  end

  Decidim::User.create!(
    name: Faker::Name.name,
    email: "<EMAIL>",
    password: "<PASSWORD>",
    password_confirmation: "<PASSWORD>",
    organization: staging_organization,
    confirmed_at: Time.current,
    locale: I18n.default_locale,
    roles: ["admin"],
    tos_agreement: true
  )

  Decidim::User.create!(
    name: Faker::Name.name,
    email: "<EMAIL>",
    password: "<PASSWORD>",
    password_confirmation: "<PASSWORD>",
    confirmed_at: Time.current,
    locale: I18n.default_locale,
    organization: staging_organization,
    tos_agreement: true
  )

  participatory_process1 = Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    promoted: true,
    published_at: 2.weeks.ago,
    organization: staging_organization
  )

  Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city3.jpeg")),
    published_at: 1.week.ago,
    organization: staging_organization
  )

  Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city3.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    organization: staging_organization
  )

  Decidim::ParticipatoryProcessStep.create!(
    title: Decidim::Faker::Localized.sentence(5),
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    active: true,
    start_date: 1.month.ago.at_midnight,
    end_date: 2.months.from_now.at_midnight,
    participatory_process: participatory_process1
  )

  Decidim::ParticipatoryProcessStep.create!(
    title: Decidim::Faker::Localized.sentence(5),
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    start_date: 2.months.from_now.at_midnight,
    end_date: 3.months.from_now.at_midnight,
    participatory_process: participatory_process1
  )

  Decidim::ParticipatoryProcess.find_each do |process|
    Decidim::ParticipatoryProcessAttachment.create!(
      title: Decidim::Faker::Localized.sentence(2),
      description: Decidim::Faker::Localized.sentence(5),
      file: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
      participatory_process: process
    )
    Decidim::ParticipatoryProcessAttachment.create!(
      title: Decidim::Faker::Localized.sentence(2),
      description: Decidim::Faker::Localized.sentence(5),
      file: File.new(File.join(File.dirname(__FILE__), "seeds", "Exampledocument.pdf")),
      participatory_process: process
    )
    2.times do
      Decidim::Category.create!(
        name: Decidim::Faker::Localized.sentence(5),
        description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
          Decidim::Faker::Localized.paragraph(3)
        end,
        participatory_process: process
      )
    end
  end
end
<commit_msg>Use a state in the name of the scope (#478)<commit_after># frozen_string_literal: true
if !Rails.env.production? || ENV["SEED"]
  require "decidim/faker/localized"

  staging_organization = Decidim::Organization.create!(
    name: Faker::Company.name,
    host: ENV["DECIDIM_HOST"] || "localhost",
    welcome_text: Decidim::Faker::Localized.sentence(5),
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(15)
    end,
    homepage_image: File.new(File.join(File.dirname(__FILE__), "seeds", "homepage_image.jpg")),
    default_locale: I18n.default_locale,
    available_locales: Decidim.available_locales
  )

  3.times do
    Decidim::Scope.create!(
      name: Faker::Address.state,
      organization: staging_organization
    )
  end

  Decidim::User.create!(
    name: Faker::Name.name,
    email: "<EMAIL>",
    password: "<PASSWORD>",
    password_confirmation: "<PASSWORD>",
    organization: staging_organization,
    confirmed_at: Time.current,
    locale: I18n.default_locale,
    roles: ["admin"],
    tos_agreement: true
  )

  Decidim::User.create!(
    name: Faker::Name.name,
    email: "<EMAIL>",
    password: "<PASSWORD>",
    password_confirmation: "decidim123456",
    confirmed_at: Time.current,
    locale: I18n.default_locale,
    organization: staging_organization,
    tos_agreement: true
  )

  participatory_process1 = Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    promoted: true,
    published_at: 2.weeks.ago,
    organization: staging_organization
  )

  Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city3.jpeg")),
    published_at: 1.week.ago,
    organization: staging_organization
  )

  Decidim::ParticipatoryProcess.create!(
    title: Decidim::Faker::Localized.sentence(5),
    slug: Faker::Internet.slug(nil, "-"),
    subtitle: Decidim::Faker::Localized.sentence(2),
    hashtag: "##{Faker::Lorem.word}",
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    hero_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city3.jpeg")),
    banner_image: File.new(File.join(File.dirname(__FILE__), "seeds", "city2.jpeg")),
    organization: staging_organization
  )

  Decidim::ParticipatoryProcessStep.create!(
    title: Decidim::Faker::Localized.sentence(5),
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    active: true,
    start_date: 1.month.ago.at_midnight,
    end_date: 2.months.from_now.at_midnight,
    participatory_process: participatory_process1
  )

  Decidim::ParticipatoryProcessStep.create!(
    title: Decidim::Faker::Localized.sentence(5),
    short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.sentence(3)
    end,
    description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
      Decidim::Faker::Localized.paragraph(3)
    end,
    start_date: 2.months.from_now.at_midnight,
    end_date: 3.months.from_now.at_midnight,
    participatory_process: participatory_process1
  )

  Decidim::ParticipatoryProcess.find_each do |process|
    Decidim::ParticipatoryProcessAttachment.create!(
      title: Decidim::Faker::Localized.sentence(2),
      description: Decidim::Faker::Localized.sentence(5),
      file: File.new(File.join(File.dirname(__FILE__), "seeds", "city.jpeg")),
      participatory_process: process
    )
    Decidim::ParticipatoryProcessAttachment.create!(
      title: Decidim::Faker::Localized.sentence(2),
      description: Decidim::Faker::Localized.sentence(5),
      file: File.new(File.join(File.dirname(__FILE__), "seeds", "Exampledocument.pdf")),
      participatory_process: process
    )
    2.times do
      Decidim::Category.create!(
        name: Decidim::Faker::Localized.sentence(5),
        description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
          Decidim::Faker::Localized.paragraph(3)
        end,
        participatory_process: process
      )
    end
  end
end

{'fraction_non_alphanumeric': 0.16508139747576367, 'fraction_numerical': 0.009785988659228096, 'mean_word_length': 4.4675, 'pattern_counts': {'":': 0, '<': 62, '<?xml version=': 0, '>': 62, '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': '4789167', 'n_tokens_mistral': 3895, 'n_tokens_neox': 3772, 'n_words': 529}