<commit_before>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :token_authenticatable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me,
                  :name, :projects_limit, :skype, :linkedin, :twitter

  has_many :users_projects, :dependent => :destroy
  has_many :projects, :through => :users_projects
  has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id
  has_many :keys, :dependent => :destroy
  has_many :issues,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :notes,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :assigned_issues,
    :class_name => "Issue",
    :foreign_key => :assignee_id,
    :dependent => :destroy

  has_many :merge_requests,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :assigned_merge_requests,
    :class_name => "MergeRequest",
    :foreign_key => :assignee_id,
    :dependent => :destroy

  before_create :ensure_authentication_token
  alias_attribute :private_token, :authentication_token
  scope :not_in_project, lambda { |project|  where("id not in (:ids)", :ids => project.users.map(&:id) ) }

  def identifier
    email.gsub /[@.]/, "_"
  end

  def is_admin?
    admin
  end

  def can_create_project?
    projects_limit >= my_own_projects.count
  end

  def last_activity_project
    projects.first
  end
end
# == Schema Information
#
# Table name: users
#<commit_msg>fix project limit<commit_after>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :token_authenticatable,
         :recoverable, :rememberable, :trackable, :validatable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me,
                  :name, :projects_limit, :skype, :linkedin, :twitter

  has_many :users_projects, :dependent => :destroy
  has_many :projects, :through => :users_projects
  has_many :my_own_projects, :class_name => "Project", :foreign_key => :owner_id
  has_many :keys, :dependent => :destroy
  has_many :issues,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :notes,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :assigned_issues,
    :class_name => "Issue",
    :foreign_key => :assignee_id,
    :dependent => :destroy

  has_many :merge_requests,
    :foreign_key => :author_id,
    :dependent => :destroy

  has_many :assigned_merge_requests,
    :class_name => "MergeRequest",
    :foreign_key => :assignee_id,
    :dependent => :destroy

  before_create :ensure_authentication_token
  alias_attribute :private_token, :authentication_token
  scope :not_in_project, lambda { |project|  where("id not in (:ids)", :ids => project.users.map(&:id) ) }

  def identifier
    email.gsub /[@.]/, "_"
  end

  def is_admin?
    admin
  end

  def can_create_project?
    projects_limit > my_own_projects.count
  end

  def last_activity_project
    projects.first
  end
end
# == Schema Information
#
# Table name: users
#
{'fraction_non_alphanumeric': 0.11314809510169006, 'fraction_numerical': 0.0, 'mean_word_length': 4.331297709923664, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '5729037', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1084, 'n_words': 266}