<commit_before># == Schema Information
#
# Table name: users
#
#  id          :integer          not null, primary key
#  github_id   :string(255)      not null
#  github_data :json
#  name        :string(255)
#  email       :string(255)
#  created_at  :datetime
#  updated_at  :datetime
#  is_admin    :boolean
#  auth_token  :string(255)      default(""), not null
#

class User < ActiveRecord::Base
  include Future
  include User::Github

  has_many :cohorts, :through => :cohort_users
  has_many :cohort_users

  has_many :test_reports

  before_save do |me|
    self.email = self.email.downcase
    self.github_id = self.github_id.downcase
  end

  def leave_cohort(cohort)
    cohort_users.where(cohort_id: cohort).destroy_all
  end

  def github_data=(data)
    self["github_data"] = data
    self.email ||= data["email"]
    self.name ||= data["name"]
    data
  end

  def generate_auth_token
    self.auth_token = SecureRandom.hex
  end

  def reset_auth_token!
    self.generate_auth_token
    self.save!
  end
end<commit_msg>fix bug<commit_after># == Schema Information
#
# Table name: users
#
#  id          :integer          not null, primary key
#  github_id   :string(255)      not null
#  github_data :json
#  name        :string(255)
#  email       :string(255)
#  created_at  :datetime
#  updated_at  :datetime
#  is_admin    :boolean
#  auth_token  :string(255)      default(""), not null
#

class User < ActiveRecord::Base
  include Future
  include User::Github

  has_many :cohorts, :through => :cohort_users
  has_many :cohort_users

  has_many :test_reports

  before_save do |me|
    me.email = me.email.downcase
    me.github_id = me.github_id.downcase
  end

  def leave_cohort(cohort)
    cohort_users.where(cohort_id: cohort).destroy_all
  end

  def github_data=(data)
    self["github_data"] = data
    self.email ||= data["email"]
    self.name ||= data["name"]
    data
  end

  def generate_auth_token
    self.auth_token = SecureRandom.hex
  end

  def reset_auth_token!
    self.generate_auth_token
    self.save!
  end
end
{'fraction_non_alphanumeric': 0.10097087378640776, 'fraction_numerical': 0.011650485436893204, 'mean_word_length': 3.0570866141732282, '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': '3664009', 'n_tokens_mistral': 766, 'n_tokens_neox': 707, 'n_words': 164}