<commit_before># == Schema Information
#
# Table name: categories
#
#  id                     :integer          not null, primary key
#  name                   :string(255)
#  solo                   :boolean
#  ensemble               :boolean
#  created_at             :datetime         not null
#  updated_at             :datetime         not null
#  slug                   :string(255)
#  official_min_age_group :string(255)      default("Ia")
#  official_max_age_group :string(255)      default("VII")
#  max_round              :integer
#  genre                  :string(255)
#

# -*- encoding : utf-8 -*-
class Category < ActiveRecord::Base
  attr_accessible :name, :solo, :ensemble, :genre, :slug,
    :max_round, :official_min_age_group, :official_max_age_group

  # Define default sorting order for categories
  default_scope order: 'genre, solo DESC, ensemble DESC, name'

  has_many :contest_categories, dependent: :destroy

  validates :name, presence: true
  validates :slug, presence: true
  validates :max_round,
    presence: true,
    inclusion: { in: 1..3 }
  validates :official_min_age_group, presence: true,
                                     inclusion: { :in => JUMU_AGE_GROUPS }
  validates :official_max_age_group, presence: true,
                                     inclusion: { :in => JUMU_AGE_GROUPS }
  # Check that either solo, ensemble or both are true – how?

  def kimu?
    self.genre == 'kimu'
  end
<commit_msg>Validate that category genre is in JUMU_GENRES<commit_after># == Schema Information
#
# Table name: categories
#
#  id                     :integer          not null, primary key
#  name                   :string(255)
#  solo                   :boolean
#  ensemble               :boolean
#  created_at             :datetime         not null
#  updated_at             :datetime         not null
#  slug                   :string(255)
#  official_min_age_group :string(255)      default("Ia")
#  official_max_age_group :string(255)      default("VII")
#  max_round              :integer
#  genre                  :string(255)
#

# -*- encoding : utf-8 -*-
class Category < ActiveRecord::Base
  attr_accessible :name, :solo, :ensemble, :genre, :slug,
    :max_round, :official_min_age_group, :official_max_age_group

  # Define default sorting order for categories
  default_scope order: 'genre, solo DESC, ensemble DESC, name'

  has_many :contest_categories, dependent: :destroy

  validates :name, presence: true
  validates :genre, inclusion: { in: JUMU_GENRES }
  validates :slug, presence: true
  validates :max_round,
    presence: true,
    inclusion: { in: 1..3 }
  validates :official_min_age_group, presence: true,
                                     inclusion: { :in => JUMU_AGE_GROUPS }
  validates :official_max_age_group, presence: true,
                                     inclusion: { :in => JUMU_AGE_GROUPS }
  # Check that either solo, ensemble or both are true – how?

  def kimu?
    self.genre == 'kimu'
  end

{'fraction_non_alphanumeric': 0.09335124244459368, 'fraction_numerical': 0.01208865010073875, 'mean_word_length': 2.1691489361702128, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1512178', 'n_tokens_mistral': 932, 'n_tokens_neox': 898, 'n_words': 241}