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

  has_and_belongs_to_many :shifts, -> { uniq }
  has_and_belongs_to_many :roles, -> { uniq }

  def role?(role)
    roles.collect(&:name).map(&:downcase).include? role.to_s
  end

  def display_name
    name = self.nickname || self.given_name || self.email || 'Nameless'
  end

  def full_name
    name = self.given_name if not self.given_name.try(:empty?)
    name += ' ' if name and self.family_name.try(:empty?)
    name = (name || '') + self.family_name if self.family_name and not self.family_name.try(:empty?)
    name ||= self.nickname || self.email || 'Nameless'
  end
  
  def self.from_omniauth(auth)<commit_msg>fixing space in full name<commit_after>class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :confirmable, :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable, :omniauthable,
         :recoverable, :rememberable, :trackable, :validatable

  has_and_belongs_to_many :shifts, -> { uniq }
  has_and_belongs_to_many :roles, -> { uniq }

  def role?(role)
    roles.collect(&:name).map(&:downcase).include? role.to_s
  end

  def display_name
    name = self.nickname || self.given_name || self.email || 'Nameless'
  end

  def full_name
    name = self.given_name if self.given_name and not self.given_name.try(:empty?)
    name += ' ' if name and not self.family_name.try(:empty?)
    name = (name || '') + self.family_name if self.family_name and not self.family_name.try(:empty?)
    name ||= self.nickname || self.email || 'Nameless'
  end
  
  def self.from_omniauth(auth)
{'fraction_non_alphanumeric': 0.12566844919786097, 'fraction_numerical': 0.0, 'mean_word_length': 4.126027397260274, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '762387', 'n_tokens_mistral': 650, 'n_tokens_neox': 621, 'n_words': 144}