<commit_before>class Availability < ActiveRecord::Base
  belongs_to :user

  validates :user_id, presence: true
  validates :start_time, presence: true, date: { before: :end_time }
  validates :end_time, presence: true, date: { after: :start_time }
  # TODO: Recurrence validator
end
<commit_msg>Add preference_level AR validator to Availability<commit_after>class Availability < ActiveRecord::Base
  # Constants
  LOW_PREFERENCE = 1
  MED_PREFERENCE = 2
  HIGH_PREFERENCE = 3

  # Relations
  belongs_to :user

  # Validators
  validates :user, presence: true
  validates :preference_level, presence: true, numericality: { only_integer: true },
    inclusion: { in: LOW_PREFERENCE..HIGH_PREFERENCE }
  validates :start_time, presence: true, date: { before: :end_time }
  validates :end_time, presence: true, date: { after: :start_time }
  # TODO: Recurrence validator
end

{'fraction_non_alphanumeric': 0.09278350515463918, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 5.069444444444445, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6508347', 'n_tokens_mistral': 291, 'n_tokens_neox': 285, 'n_words': 78}