<commit_before>class Loan
  include DataMapper::Resource
  include FeesContainer
  include Identified
  include Pdf::LoanSchedule if PDF_WRITER
  include ExcelFormula

  DAYS = [:none, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]

  before :valid?,  :parse_dates
  before :valid?,  :convert_blank_to_nil
  after  :save,    :update_history_caller  # also seems to do updates
  after  :create,  :levy_fees_new          # we need a separate one for create for a variety of reasons to  do with overwriting old fees
  before :save,    :levy_fees
  before :save,    :update_loan_cache
  after  :create,  :update_cycle_number
  before :destroy, :verified_cannot_be_deleted
  before :valid?,    :set_loan_product_parameters
  before :save, :set_bullet_installments

  def rs
    self.repayment_style or self.loan_product.repayment_style
  end

  def set_bullet_installments
    number_of_installments = 1 if rs.style == "BulletLoan"
  end


  #  after  :destroy, :update_history

  before :valid?, :set_amount
  validates_with_method :original_properties_specified?, :when => Proc.new{|l| l.taken_over?}
  validates_with_method :taken_over_properly?, :when => Proc.new{|l| l.taken_over?}



  attr_accessor :history_disabled  # set to true to disable history writing by this object
  attr_accessor :interest_percentage
  attr_accessor :already_updated
  attr_accessor :orig_attrs
  attr_accessor :loan_extended          # set to true if you have mixed in the appropriate loan repayment functions

  property :id,                             Serial<commit_msg>fixed changing fees for changing amounts bug<commit_after>class Loan
  include DataMapper::Resource
  include FeesContainer
  include Identified
  include Pdf::LoanSchedule if PDF_WRITER
  include ExcelFormula

  DAYS = [:none, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]

  before :valid?,  :parse_dates
  before :valid?,  :convert_blank_to_nil
  after  :save,    :update_history_caller  # also seems to do updates
  before :save,    :update_loan_cache
  after  :create,  :levy_fees_new          # we need a separate one for create for a variety of reasons to  do with overwriting old fees
  before :save,    :levy_fees
  after  :create,  :update_cycle_number
  before :destroy, :verified_cannot_be_deleted
  before :valid?,    :set_loan_product_parameters
  before :save, :set_bullet_installments

  def rs
    self.repayment_style or self.loan_product.repayment_style
  end

  def set_bullet_installments
    number_of_installments = 1 if rs.style == "BulletLoan"
  end


  #  after  :destroy, :update_history

  before :valid?, :set_amount
  validates_with_method :original_properties_specified?, :when => Proc.new{|l| l.taken_over?}
  validates_with_method :taken_over_properly?, :when => Proc.new{|l| l.taken_over?}



  attr_accessor :history_disabled  # set to true to disable history writing by this object
  attr_accessor :interest_percentage
  attr_accessor :already_updated
  attr_accessor :orig_attrs
  attr_accessor :loan_extended          # set to true if you have mixed in the appropriate loan repayment functions

  property :id,                             Serial
{'fraction_non_alphanumeric': 0.07032967032967033, 'fraction_numerical': 0.0006279434850863422, 'mean_word_length': 4.113964686998395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '871907', 'n_tokens_mistral': 1047, 'n_tokens_neox': 986, 'n_words': 289}