<commit_before>class Account < ActiveRecord::Base
  #
  # Attributes
  store :settings, accessors: [:interest_rate, :credit_limit]

  attr_accessor :opening_balance, :opening_date
  columns_hash["opening_date"] = ActiveRecord::ConnectionAdapters::Column.new("opening_date", nil, "date")

  #
  # Validations
  validates :name, :presence => true
  validates :opening_balance, :numericality => true, :allow_nil => true

  #
  # Callbacks
  before_save :set_user_currency
  after_create :create_opening_transaction

  #
  # Relations
  belongs_to :user
  belongs_to :currency
  
  has_many :transaction_items,
    :order => "transactions.operation_date DESC, transactions.id DESC"

  has_many :transactions, 
    :through => :transaction_items,
    :group => "transactions.id",
    :order => "transactions.operation_date DESC, transactions.id DESC",
    :include => [:transaction_items, :accounts, :categories]

  #
  # Scopes
  scope :favorites, where(favorite: true)
  scope :no_favorites, where(favorite: false)
  scope :payees, where(payee: true)
  scope :no_payees, where(payee: false)
  scope :systems, where(system: true)
  scope :no_systems, where(system: false)
  scope :users, where(payee: false, system: false)<commit_msg>remove payee scope<commit_after>class Account < ActiveRecord::Base
  #
  # Attributes
  store :settings, accessors: [:interest_rate, :credit_limit]

  attr_accessor :opening_balance, :opening_date
  columns_hash["opening_date"] = ActiveRecord::ConnectionAdapters::Column.new("opening_date", nil, "date")

  #
  # Validations
  validates :name, :presence => true
  validates :opening_balance, :numericality => true, :allow_nil => true

  #
  # Callbacks
  before_save :set_user_currency
  after_create :create_opening_transaction

  #
  # Relations
  belongs_to :user
  belongs_to :currency
  
  has_many :transaction_items,
    :order => "transactions.operation_date DESC, transactions.id DESC"

  has_many :transactions, 
    :through => :transaction_items,
    :group => "transactions.id",
    :order => "transactions.operation_date DESC, transactions.id DESC",
    :include => [:transaction_items, :accounts, :categories]

  #
  # Scopes
  scope :favorites, where(favorite: true)
  scope :no_favorites, where(favorite: false)
  scope :systems, where(system: true)
  scope :no_systems, where(system: false)
  scope :users, where(payee: false, system: false)
{'fraction_non_alphanumeric': 0.11552951025533696, 'fraction_numerical': 0.0, 'mean_word_length': 5.081424936386768, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4187245', 'n_tokens_mistral': 804, 'n_tokens_neox': 770, 'n_words': 173}