<commit_before>class Ccportal::Student < Ccportal::Member
  has_many :class_students, :foreign_key => :member_id, :class_name => 'Ccportal::ClassStudent'
  has_many :courses, :through => :class_students, :foreign_key => :class_id, :class_name => 'Ccportal::Course'
  has_many :modified_times, :foreign_key => :student_id, :class_name => "ModifiedTime" do
    def by_activity(activity)
      find(:all, :conditions => {:activity_id => activity.id})
    end
  end

  has_many :teachers,
    :class_name => 'Ccportal::Teacher',
    :finder_sql => 'SELECT DISTINCT portal_members.* FROM portal_members
    INNER JOIN portal_classes ON portal_classes.class_teacher = portal_members.member_id
    INNER JOIN portal_class_students ON portal_class_students.class_id = portal_classes.class_id    
    WHERE portal_class_students.member_id = #{id}'

  def self.find(*args)
    with_scope(:find => { :conditions => "member_type = 'student'" } ) do
      super
    end
  end

  # def teachers
  #   courses.collect{|c| c.teacher }.flatten.uniq   
  # end
  # 
  # # Filter all members by member_type
  # def self.find(*args)
  #   if args.first == :all || args.first == :first
  #     saw_conditions = false
  #     args.each do |a|
  #       if a.kind_of?(Hash) && a[:conditions]
  #         saw_conditions = true
  #         if a[:conditions].kind_of?(Hash)
  #           a[:conditions][:member_type] = 'student'
  #         else
  #           a[:conditions] << " AND member_type = 'student'"
  #         end<commit_msg>remove has_many :modified_times from Ccportal::Student<commit_after>class Ccportal::Student < Ccportal::Member
  has_many :class_students, :foreign_key => :member_id, :class_name => 'Ccportal::ClassStudent'
  has_many :courses, :through => :class_students, :foreign_key => :class_id, :class_name => 'Ccportal::Course'

  has_many :teachers,
    :class_name => 'Ccportal::Teacher',
    :finder_sql => 'SELECT DISTINCT portal_members.* FROM portal_members
    INNER JOIN portal_classes ON portal_classes.class_teacher = portal_members.member_id
    INNER JOIN portal_class_students ON portal_class_students.class_id = portal_classes.class_id    
    WHERE portal_class_students.member_id = #{id}'

  def self.find(*args)
    with_scope(:find => { :conditions => "member_type = 'student'" } ) do
      super
    end
  end

  # def teachers
  #   courses.collect{|c| c.teacher }.flatten.uniq   
  # end
  # 
  # # Filter all members by member_type
  # def self.find(*args)
  #   if args.first == :all || args.first == :first
  #     saw_conditions = false
  #     args.each do |a|
  #       if a.kind_of?(Hash) && a[:conditions]
  #         saw_conditions = true
  #         if a[:conditions].kind_of?(Hash)
  #           a[:conditions][:member_type] = 'student'
  #         else
  #           a[:conditions] << " AND member_type = 'student'"
  #         end
{'fraction_non_alphanumeric': 0.1270949720670391, 'fraction_numerical': 0.0, 'mean_word_length': 3.3607305936073057, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '7223581', 'n_tokens_mistral': 967, 'n_tokens_neox': 957, 'n_words': 198}