<commit_before>class User < ActiveRecord::Base
  has_many :tickets
  has_many :comments

  before_create :set_default_role

  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :first_name, :last_name, :password, :password_confirmation, :remember_me

  scope :agents, where("role = ? OR ?", "agent", "admin")
  scope :admins, where(:role => "admin")

  ROLES = %w[customer agent admin]

  def self.default_agent
    # TODO: Make this configurable in the app
    User.first
  end

  def name
    return [self.first_name, self.last_name].join(" ").lstrip
  end

  def to_s
    if self.name.to_s.empty?
      return self.email
    else
      return self.name
    end
  end<commit_msg>Make sure User.default_agent is agent-level or higher<commit_after>class User < ActiveRecord::Base
  has_many :tickets
  has_many :comments

  before_create :set_default_role

  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :first_name, :last_name, :password, :password_confirmation, :remember_me

  scope :agents, where("role = ? OR ?", "agent", "admin")
  scope :admins, where(:role => "admin")

  ROLES = %w[customer agent admin]

  def self.default_agent
    # TODO: Make this configurable in the app
    User.agents.first
  end

  def name
    return [self.first_name, self.last_name].join(" ").lstrip
  end

  def to_s
    if self.name.to_s.empty?
      return self.email
    else
      return self.name
    end
  end
{'fraction_non_alphanumeric': 0.0974764967837704, 'fraction_numerical': 0.0, 'mean_word_length': 4.029850746268656, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2835607', 'n_tokens_mistral': 656, 'n_tokens_neox': 620, 'n_words': 181}