<commit_before>require 'parted'
require 'state_machine'
require 'safe_html'

class TravelAdviceEdition
  include Mongoid::Document
  include Mongoid::Timestamps
  include Parted

  field :country_slug,         type: String
  field :title,                type: String
  field :overview,             type: String
  field :version_number,       type: Integer
  field :state,                type: String,    default: "draft"
  field :alert_status,         type: Array,     default: [ ]

  embeds_many :actions

  index [[:country_slug, Mongo::ASCENDING], [:version_number, Mongo::DESCENDING]], :unique => true

  GOVSPEAK_FIELDS = []
  ALERT_STATUSES = [
    "no_restrictions",
    "avoid_all_but_essential_travel_to_parts",
    "avoid_all_but_essential_travel_to_whole_country",
    "avoid_all_travel_to_parts",
    "avoid_all_travel_to_whole_country",
  ]

  before_validation :populate_version_number, :on => :create

  validates_presence_of :country_slug
  validate :state_for_slug_unique
  validates :version_number, :presence => true, :uniqueness => { :scope => :country_slug }
  validate :state_if_modified
  validate :alert_status_contains_valid_values
  validates_with SafeHtml

  scope :published, where(:state => "published")

  class << self; attr_accessor :fields_to_clone end<commit_msg>Remove the no restrictions alert status<commit_after>require 'parted'
require 'state_machine'
require 'safe_html'

class TravelAdviceEdition
  include Mongoid::Document
  include Mongoid::Timestamps
  include Parted

  field :country_slug,         type: String
  field :title,                type: String
  field :overview,             type: String
  field :version_number,       type: Integer
  field :state,                type: String,    default: "draft"
  field :alert_status,         type: Array,     default: [ ]

  embeds_many :actions

  index [[:country_slug, Mongo::ASCENDING], [:version_number, Mongo::DESCENDING]], :unique => true

  GOVSPEAK_FIELDS = []
  ALERT_STATUSES = [
    "avoid_all_but_essential_travel_to_parts",
    "avoid_all_but_essential_travel_to_whole_country",
    "avoid_all_travel_to_parts",
    "avoid_all_travel_to_whole_country",
  ]

  before_validation :populate_version_number, :on => :create

  validates_presence_of :country_slug
  validate :state_for_slug_unique
  validates :version_number, :presence => true, :uniqueness => { :scope => :country_slug }
  validate :state_if_modified
  validate :alert_status_contains_valid_values
  validates_with SafeHtml

  scope :published, where(:state => "published")

  class << self; attr_accessor :fields_to_clone end
{'fraction_non_alphanumeric': 0.08971890643049672, 'fraction_numerical': 0.0, 'mean_word_length': 4.227364185110664, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '4022398', 'n_tokens_mistral': 853, 'n_tokens_neox': 810, 'n_words': 177}