<commit_before>class User < ActiveRecord::Base
  has_many   :tickets
  has_many   :receipts
  has_many   :bonuses
  has_many   :members
  has_many   :comments
  
  before_create :create_remember_token

# Validates the user's name
  validates :first_name, :last_name, format: {
    with: /\A[-a-zA-Z]+\z/,
    message: 'must only have letters (no digits).'
  }, unless: Proc.new { |user| user.role == -1 }

# Validates the user's school id
  validates :school_id, presence: true, uniqueness: true, unless: Proc.new { |user| user.role == -1 }
  
# Validates the email
  validates :email, uniqueness: true, format: {
    with: /\A([^@\s]+)@(students.pcci.edu|faculty.pcci.edu)\Z/,
    message: 'must be a valid PCC email address.'
  }, unless: Proc.new { |user| user.role == -1 }

# Validates the phone number
  validates :phone, format: {
    with: /\A(((17)\s-\s\d{4}\s-\s[1-4])|((\d{3}\s*-\s*){1,2}\d{4}(\s*[Ee][Xx][Tt]\.?\s*\d{1,7}))?)\z/,
    message: 'must be a valid PCC phone number or valid telephone number.'
  }, unless: Proc.new { |user| user.role == -1 }
  
# Validates the box number
  validates :box, length: {
    minimum: 3, maximum: 4,
    message: 'is the wrong length.  Needs to be either three or four digits long.'
  }, numericality: { greater_than: 0 }, unless: Proc.new { |user| user.role == -1 }

      ### BEGIN CONFIGURATION ###
      SERVER = 'studentnet.int'        # Active Directory server name or IP
      PORT = 636                       # Active Directory server port (default 389)
      BASE = 'DC=studentnet,DC=int'    # Base to search from
      DOMAIN = 'studentnet.int'        # For simplified user@domain format login
      ### END CONFIGURATION ###

def self.get_student_info(project, section)
  members = Member.student_members(project, section)
  Struct.new("Person", :id, :first_name, :last_name, :school_id, :email, :phone,
                            :student_manager_name, :section_number, :major, :minor, :box, :class)
  students = []
  members.each_with_index do |member, i|
     students[i]                      = Struct::Person.new
     students[i].id                   = member.user_id
     students[i].first_name           = member.user.first_name
     students[i].last_name            = member.user.last_name
     students[i].school_id            = member.user.school_id
     students[i].email                = member.user.email
     students[i].phone                = member.user.phone
     students[i].student_manager_name = Member.get_manager_name(member)<commit_msg>going to push<commit_after>class User < ActiveRecord::Base
  has_many   :tickets
  has_many   :receipts
  has_many   :bonuses
  has_many   :members
  has_many   :comments
  
  before_create :create_remember_token

# Validates the user's name
  validates :first_name, :last_name, format: {
    with: /\A[-a-zA-Z]+\z/,
    message: 'must only have letters (no digits).'
  }, unless: Proc.new { |user| user.role == -1 }

# Validates the user's school id
  validates :school_id, presence: true, uniqueness: true, unless: Proc.new { |user| user.role == -1 }
  
# Validates the email
  validates :email, uniqueness: true, format: {
    with: /\A([^@\s]+)@(students.pcci.edu|faculty.pcci.edu)\Z/,
    message: 'must be a valid PCC email address.'
  }, unless: Proc.new { |user| user.role == -1 }

# Validates the phone number
  validates :phone, format: {
    with: /\A(([tT][oO][wW][nN])|((17)\s*[-]\s*(\d{4})\s*[-]\s*([1-4]{1}))*|(((\d{3})?\s*[-]\s*)*(\d{3})\s*[-]\s*(\d{4})\s*(([eE][xX][tT])\.?\s*(\d{1,4}))*))\z/,
    message: 'must be a valid PCC phone number or valid telephone number.'
  }, unless: Proc.new { |user| user.role == -1 }
  
# Validates the box number
  validates :box, length: {
    minimum: 3, maximum: 4,
    message: 'is the wrong length.  Needs to be either three or four digits long.'
  }, numericality: { greater_than: 0 }, unless: Proc.new { |user| user.role == -1 }

      ### BEGIN CONFIGURATION ###
      SERVER = 'studentnet.int'        # Active Directory server name or IP
      PORT = 636                       # Active Directory server port (default 389)
      BASE = 'DC=studentnet,DC=int'    # Base to search from
      DOMAIN = 'studentnet.int'        # For simplified user@domain format login
      ### END CONFIGURATION ###

def self.get_student_info(project, section)
  members = Member.student_members(project, section)
  Struct.new("Person", :id, :first_name, :last_name, :school_id, :email, :phone,
                            :student_manager_name, :section_number, :major, :minor, :box, :class)
  students = []
  members.each_with_index do |member, i|
     students[i]                      = Struct::Person.new
     students[i].id                   = member.user_id
     students[i].first_name           = member.user.first_name
     students[i].last_name            = member.user.last_name
     students[i].school_id            = member.user.school_id
     students[i].email                = member.user.email
     students[i].phone                = member.user.phone
     students[i].student_manager_name = Member.get_manager_name(member)
{'fraction_non_alphanumeric': 0.1484313725490196, 'fraction_numerical': 0.00980392156862745, 'mean_word_length': 2.7098181818181817, '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': '2595573', 'n_tokens_mistral': 1754, 'n_tokens_neox': 1688, 'n_words': 417}