<commit_before>class Wholesaler < ActiveRecord::Base
  
  partial_updates = false
  
  belongs_to :user, :dependent => :destroy  
  belongs_to :bill_address, :foreign_key => "billing_address_id", :class_name => "Address", :dependent => :destroy
  belongs_to :ship_address, :foreign_key => "shipping_address_id", :class_name => "Address", :dependent => :destroy
  
  validates :company, :buyer_contact, :phone, :presence => true
  validate :validate_parts
    
  delegate_belongs_to :user, :roles
  delegate_belongs_to :user, :email
    
  def validate_parts
    uv = user && user.valid? 
    bv = bill_address && bill_address.valid?
    sv = ship_address && ship_address.valid?
    self.errors.add(:base, I18n.t("wholesaler.parts_error_message")) unless uv && bv && sv
  end
    
  def activate!
    get_wholesale_role
    return false if user.roles.include?(@role)
    user.roles << @role
    user.save
  end
  
  def deactivate!
    get_wholesale_role
    return false unless user.roles.include?(@role)
    user.roles.delete(@role)
    user.save
  end
  
  def active?
    user && user.has_role?("wholesaler")
  end
  
  def self.term_options
    %(Net 30, Credit Card).split(", ")
  end
  
  private
  
    def get_wholesale_role
      @role = Role.find_by_name("wholesaler")
    end
  
end<commit_msg>reversed term options for sorting<commit_after>class Wholesaler < ActiveRecord::Base
  
  partial_updates = false
  
  belongs_to :user, :dependent => :destroy  
  belongs_to :bill_address, :foreign_key => "billing_address_id", :class_name => "Address", :dependent => :destroy
  belongs_to :ship_address, :foreign_key => "shipping_address_id", :class_name => "Address", :dependent => :destroy
  
  validates :company, :buyer_contact, :phone, :presence => true
  validate :validate_parts
    
  delegate_belongs_to :user, :roles
  delegate_belongs_to :user, :email
    
  def validate_parts
    uv = user && user.valid? 
    bv = bill_address && bill_address.valid?
    sv = ship_address && ship_address.valid?
    self.errors.add(:base, I18n.t("wholesaler.parts_error_message")) unless uv && bv && sv
  end
    
  def activate!
    get_wholesale_role
    return false if user.roles.include?(@role)
    user.roles << @role
    user.save
  end
  
  def deactivate!
    get_wholesale_role
    return false unless user.roles.include?(@role)
    user.roles.delete(@role)
    user.save
  end
  
  def active?
    user && user.has_role?("wholesaler")
  end
  
  def self.term_options
    %(Credit Card, Net 30).split(", ")
  end
  
  private
  
    def get_wholesale_role
      @role = Role.find_by_name("wholesaler")
    end
  
end
{'fraction_non_alphanumeric': 0.11254752851711027, 'fraction_numerical': 0.003041825095057034, 'mean_word_length': 3.4821124361158433, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '2608995', 'n_tokens_mistral': 925, 'n_tokens_neox': 905, 'n_words': 197}