<commit_before># == Schema Information
# Schema version: 20110114122352
#
# Table name: angels
#
#  id            :integer         not null, primary key
#  display_name  :string(255)     not null
#  first_name    :string(255)
#  last_name     :string(255)     not null
#  gender        :string(255)     not null
#  address       :string(255)
#  postal_code   :string(255)
#  city          :string(255)
#  country       :string(255)
#  email         :string(255)     not null
#  home_phone    :string(255)
#  mobile_phone  :string(255)
#  work_phone    :string(255)
#  lang          :string(255)     default("en")
#  notes         :text
#  created_at    :datetime
#  updated_at    :datetime
#  highest_level :integer         default(0)
#

class Angel < ActiveRecord::Base
  geocoded_by :full_address, :latitude  => :lat, :longitude => :lng
  
  before_save :update_display_name
  after_validation :fetch_coordinates

  FEMALE = 'Female'
  MALE = 'Male'
  GENDERS = [FEMALE, MALE]

  has_many :registrations, :inverse_of => :angel, :dependent => :destroy
  has_many :events, :through => :registrations

  #default_scope order('LOWER(first_name) asc')
  scope :by_last_name, order('LOWER(last_name) asc')

  validates_presence_of :last_name, :email
  validates_inclusion_of :gender, { :in => GENDERS,
    :message => :select }

  def full_name
    [first_name, last_name].compact.join(" ")
  end

  def full_address
    [address, postal_code, city, country].compact.join(", ")
  end
  
  def display_phones
    phones = []
    phones << "H: #{home_phone}" unless home_phone.blank?
    phones << "M: #{mobile_phone}" unless mobile_phone.blank?
    phones << "W: #{work_phone}" unless work_phone.blank?
    phones.join(", ")
  end
<commit_msg>require first_name<commit_after># == Schema Information
# Schema version: 20110114122352
#
# Table name: angels
#
#  id            :integer         not null, primary key
#  display_name  :string(255)     not null
#  first_name    :string(255)
#  last_name     :string(255)     not null
#  gender        :string(255)     not null
#  address       :string(255)
#  postal_code   :string(255)
#  city          :string(255)
#  country       :string(255)
#  email         :string(255)     not null
#  home_phone    :string(255)
#  mobile_phone  :string(255)
#  work_phone    :string(255)
#  lang          :string(255)     default("en")
#  notes         :text
#  created_at    :datetime
#  updated_at    :datetime
#  highest_level :integer         default(0)
#

class Angel < ActiveRecord::Base
  geocoded_by :full_address, :latitude  => :lat, :longitude => :lng
  
  before_save :update_display_name
  after_validation :fetch_coordinates

  FEMALE = 'Female'
  MALE = 'Male'
  GENDERS = [FEMALE, MALE]

  has_many :registrations, :inverse_of => :angel, :dependent => :destroy
  has_many :events, :through => :registrations

  #default_scope order('LOWER(first_name) asc')
  scope :by_last_name, order('LOWER(last_name) asc')

  validates_presence_of :first_name, :last_name, :email
  validates_inclusion_of :gender, { :in => GENDERS,
    :message => :select }

  def full_name
    [first_name, last_name].compact.join(" ")
  end

  def full_address
    [address, postal_code, city, country].compact.join(", ")
  end
  
  def display_phones
    phones = []
    phones << "H: #{home_phone}" unless home_phone.blank?
    phones << "M: #{mobile_phone}" unless mobile_phone.blank?
    phones << "W: #{work_phone}" unless work_phone.blank?
    phones.join(", ")
  end

{'fraction_non_alphanumeric': 0.12364052661705781, 'fraction_numerical': 0.030910131654264452, 'mean_word_length': 3.215922798552473, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '613890', 'n_tokens_mistral': 1289, 'n_tokens_neox': 1194, 'n_words': 276}