<commit_before>class Edition < ActiveRecord::Base
  STATES = %w(draft published review_requested ready unpublished).freeze
  STATES_THAT_UPDATE_THE_FRONTEND = %w(published unpublished).freeze

  belongs_to :guide, touch: true
  belongs_to :author, class_name: "User"
  belongs_to :created_by, class_name: "User"

  has_many :comments, as: :commentable

  has_one :approval

  belongs_to :content_owner, class_name: 'GuideCommunity'

  scope :draft, -> { where(state: 'draft') }
  scope :published, -> { where(state: 'published') }
  scope :review_requested, -> { where(state: 'review_requested') }
  scope :most_recent_first, -> { order('created_at DESC, id DESC') }
  scope :which_update_the_frontend, -> { where(state: STATES_THAT_UPDATE_THE_FRONTEND) }

  scope :major, -> { where(update_type: 'major') }
  scope :minor, -> { where(update_type: 'minor') }

  validates_presence_of [:state, :phase, :description, :title, :update_type, :body, :author]
  validates_inclusion_of :state, in: STATES
  validates :reason_for_change, presence: true, if: :major?
  validates :change_note, presence: true, if: :major?
  validates :version, presence: true
  validates :created_by, presence: true

  auto_strip_attributes(
    :title,
    :description,
    :body,
  )

  %w{minor major}.each do |s|
    define_method "#{s}?" do
      update_type == s
    end
  end
<commit_msg>Remove unused scope from edition model<commit_after>class Edition < ActiveRecord::Base
  STATES = %w(draft published review_requested ready unpublished).freeze
  STATES_THAT_UPDATE_THE_FRONTEND = %w(published unpublished).freeze

  belongs_to :guide, touch: true
  belongs_to :author, class_name: "User"
  belongs_to :created_by, class_name: "User"

  has_many :comments, as: :commentable

  has_one :approval

  belongs_to :content_owner, class_name: 'GuideCommunity'

  scope :draft, -> { where(state: 'draft') }
  scope :published, -> { where(state: 'published') }
  scope :review_requested, -> { where(state: 'review_requested') }
  scope :most_recent_first, -> { order('created_at DESC, id DESC') }
  scope :which_update_the_frontend, -> { where(state: STATES_THAT_UPDATE_THE_FRONTEND) }

  scope :major, -> { where(update_type: 'major') }

  validates_presence_of [:state, :phase, :description, :title, :update_type, :body, :author]
  validates_inclusion_of :state, in: STATES
  validates :reason_for_change, presence: true, if: :major?
  validates :change_note, presence: true, if: :major?
  validates :version, presence: true
  validates :created_by, presence: true

  auto_strip_attributes(
    :title,
    :description,
    :body,
  )

  %w{minor major}.each do |s|
    define_method "#{s}?" do
      update_type == s
    end
  end

{'fraction_non_alphanumeric': 0.12435424354243542, 'fraction_numerical': 0.0, 'mean_word_length': 4.893478260869565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, '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': '75319', 'n_tokens_mistral': 946, 'n_tokens_neox': 911, 'n_words': 223}