<commit_before># == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  email                  :string(255)      default(""), not null
#  encrypted_password     :string(255)      default(""), not null
#  reset_password_token   :string(255)
#  reset_password_sent_at :datetime
#  remember_created_at    :datetime
#  sign_in_count          :integer          default(0), not null
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :string(255)
#  last_sign_in_ip        :string(255)
#  created_at             :datetime
#  updated_at             :datetime
#  account_id             :integer
#  is_admin               :boolean          default(FALSE)
#  name                   :string(255)
#

class User < ActiveRecord::Base

  # ------------------------------------------ Devise

  devise :database_authenticatable, :recoverable, :trackable, :validatable

  # ------------------------------------------ Associations

  belongs_to :account

  has_many :sites, :through => :account

  # ------------------------------------------ Scopes

  scope :admins, -> { where(:is_admin => true) }
  scope :alpha, -> { order('name asc', 'email asc') }

  # ------------------------------------------ Instance Methods

  def display_name
    name || email
  end

end<commit_msg>add name methods to user<commit_after># == Schema Information
#
# Table name: users
#
#  id                     :integer          not null, primary key
#  email                  :string(255)      default(""), not null
#  encrypted_password     :string(255)      default(""), not null
#  reset_password_token   :string(255)
#  reset_password_sent_at :datetime
#  remember_created_at    :datetime
#  sign_in_count          :integer          default(0), not null
#  current_sign_in_at     :datetime
#  last_sign_in_at        :datetime
#  current_sign_in_ip     :string(255)
#  last_sign_in_ip        :string(255)
#  created_at             :datetime
#  updated_at             :datetime
#  account_id             :integer
#  is_admin               :boolean          default(FALSE)
#  name                   :string(255)
#

class User < ActiveRecord::Base

  # ------------------------------------------ Devise

  devise :database_authenticatable, :recoverable, :trackable, :validatable

  # ------------------------------------------ Associations

  belongs_to :account

  has_many :sites, :through => :account

  # ------------------------------------------ Scopes

  scope :admins, -> { where(:is_admin => true) }
  scope :alpha, -> { all.to_a.sort_by(&:last_name) }

  # ------------------------------------------ Instance Methods

  def display_name
    name || email
  end

  def first_name
    return email if name.nil?
    name.split(' ').first
  end

  def last_name
    return email if name.nil?
    name.split(' ').last
  end

end
{'fraction_non_alphanumeric': 0.20227429359062715, 'fraction_numerical': 0.013094417643004824, 'mean_word_length': 1.6059245960502693, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '7614644', 'n_tokens_mistral': 851, 'n_tokens_neox': 796, 'n_words': 192}