<commit_before>class GroupMembership < ActiveRecord::Base
  belongs_to :person
  belongs_to :work_group
  has_one :project, :through=>:work_group

  has_and_belongs_to_many :project_roles

  after_save :remember_previous_person
  after_commit :queue_update_auth_table

  validates :work_group,:presence => {:message=>"A workgroup is required"}

  def has_left=(yes = false)
    self.time_left_at = yes ? Time.now : nil
  end

  def has_left
    self.time_left_at.past? ||
        self.time_left_at.present?
  end

  def remember_previous_person
    @previous_person_id = person_id_was
  end

  def queue_update_auth_table
    people = [Person.find_by_id(person_id)]
    people << Person.find_by_id(@previous_person_id) unless @previous_person_id.blank?

    AuthLookupUpdateJob.new.add_items_to_queue people.compact
  end

end<commit_msg>Prevent nil error<commit_after>class GroupMembership < ActiveRecord::Base
  belongs_to :person
  belongs_to :work_group
  has_one :project, :through=>:work_group

  has_and_belongs_to_many :project_roles

  after_save :remember_previous_person
  after_commit :queue_update_auth_table

  validates :work_group,:presence => {:message=>"A workgroup is required"}

  def has_left=(yes = false)
    self.time_left_at = yes ? Time.now : nil
  end

  def has_left
    self.time_left_at &&
        (self.time_left_at.past? || self.time_left_at.present?)
  end

  def remember_previous_person
    @previous_person_id = person_id_was
  end

  def queue_update_auth_table
    people = [Person.find_by_id(person_id)]
    people << Person.find_by_id(@previous_person_id) unless @previous_person_id.blank?

    AuthLookupUpdateJob.new.add_items_to_queue people.compact
  end

end
{'fraction_non_alphanumeric': 0.08044627128596595, 'fraction_numerical': 0.0, 'mean_word_length': 4.795918367346939, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5604350', 'n_tokens_mistral': 601, 'n_tokens_neox': 580, 'n_words': 106}