<commit_before>class Contestant < ActiveRecord::Base
  belongs_to :edition
  validates :edition, presence: true

  belongs_to :user
  validates :user, presence: true

  has_many :colaborators, dependent: :destroy
  has_many :projects, through: :colaborators, inverse_of: :contestants

  accepts_nested_attributes_for :colaborators,
    :reject_if => :all_blank
  accepts_nested_attributes_for :projects

  validates :edition, presence: true

  validates :address, presence: true
  validates :city, presence: true
  validates :county, presence: true
  validates :country, presence: true
  validates :zip_code, presence: true

  validates :sex, presence: true
  validates :sex, numericality: { only_integer: true,
                                  greater_than_or_equal_to: 1,
                                  less_than_or_equal_to: 3}

  validates :cnp, presence: true
  validates :id_card_type, presence: true
  validates :id_card_number, presence: true

  validates :phone_number, presence: true
  validates :date_of_birth, presence: true, date: true

  validates :school_name, presence: true
  validates :grade, presence: true
  validates :school_county, presence: true
  validates :school_city, presence: true
  validates :school_country, presence: true

  validates :mentoring_teacher_first_name, presence: true
  validates :mentoring_teacher_last_name, presence: true

  validates :accompanying_teacher_first_name, presence: true
  validates :accompanying_teacher_last_name, presence: true

  def sex_enum
    [ [ :male, 1 ], [ :female, 2 ], [ :undisclosed, 3 ] ]
  end

  def name
    user.name
  end

  rails_admin do
    list do
      field :first_name
      field :last_name
      field :school_name
    end
  end
end
<commit_msg>Fixes contestants admin cc @palcu<commit_after>class Contestant < ActiveRecord::Base
  belongs_to :edition
  validates :edition, presence: true

  belongs_to :user
  validates :user, presence: true

  has_many :colaborators, dependent: :destroy
  has_many :projects, through: :colaborators, inverse_of: :contestants

  accepts_nested_attributes_for :colaborators,
    :reject_if => :all_blank
  accepts_nested_attributes_for :projects

  validates :edition, presence: true

  validates :address, presence: true
  validates :city, presence: true
  validates :county, presence: true
  validates :country, presence: true
  validates :zip_code, presence: true

  validates :sex, presence: true
  validates :sex, numericality: { only_integer: true,
                                  greater_than_or_equal_to: 1,
                                  less_than_or_equal_to: 3}

  validates :cnp, presence: true
  validates :id_card_type, presence: true
  validates :id_card_number, presence: true

  validates :phone_number, presence: true
  validates :date_of_birth, presence: true, date: true

  validates :school_name, presence: true
  validates :grade, presence: true
  validates :school_county, presence: true
  validates :school_city, presence: true
  validates :school_country, presence: true

  validates :mentoring_teacher_first_name, presence: true
  validates :mentoring_teacher_last_name, presence: true

  validates :accompanying_teacher_first_name, presence: true
  validates :accompanying_teacher_last_name, presence: true

  def sex_enum
    [ [ :male, 1 ], [ :female, 2 ], [ :undisclosed, 3 ] ]
  end

  def first_name
    user.first_name
  end

  def last_name
    user.last_name
  end

  def name
    user.name if user
  end

  rails_admin do
    list do
      field :first_name
      field :last_name
      field :school_name
    end
  end
end

{'fraction_non_alphanumeric': 0.07150806900389538, 'fraction_numerical': 0.0027824151363383415, 'mean_word_length': 3.8125836680053546, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5361215', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1116, 'n_words': 318}