<commit_before>class Student < ActiveRecord::Base
  has_many :records
  has_many :projects, through: :records
  # belongs_to :project, inverse_of: :assigned_students

  validates :name, :email, { presence: true }
  validates :email, { uniqueness: true }

  has_secure_password

  def total_hours_worked
  	sum = 0 
  	self.records.each do |record|
  		sum += record.hours_worked
  	end
  	sum 
  end

  def hours_per_project(project_id)
    records = Record.where(project_id: project_id, student_id: self.id)
    sum = 0 
    records.each do |record|
      sum += record.hours_worked
    end
    sum
  end

  def working_on(project)
    project.students.include?(self)
  end
end<commit_msg>it works\!<commit_after>class Student < ActiveRecord::Base
  has_many :records
  has_many :projects, through: :records
  # belongs_to :project, inverse_of: :assigned_students

  validates :name, :email, { presence: true }
  validates :email, { uniqueness: true }

  has_secure_password

  def total_hours_worked
  	sum = 0 
  	self.records.each do |record|
  		sum += record.hours_worked
  	end
  	sum 
  end

  def hours_per_project(project_id)
    records = Record.where(project_id: project_id, student_id: self.id)
    sum = 0 
    records.each do |record|
      sum += record.hours_worked
    end
    sum
  end

  def working_on(project)
    zero_records = project.records.where(hours_worked: 0)

    zero_records.where(student_id: self.id).any?
  end
end
{'fraction_non_alphanumeric': 0.08971704623878538, 'fraction_numerical': 0.003450655624568668, 'mean_word_length': 3.4753086419753085, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7619888', 'n_tokens_mistral': 524, 'n_tokens_neox': 486, 'n_words': 118}