<commit_before>class Ownership < ActiveRecord::Base
  belongs_to :user

  def self.total_at(date)
    where('date <= ?', date).sum(:units)
  end

  def self.new_unit_per_amount_multiplier_at(date)
    # Assume all contributions and expenses are incurred at once on the same day
    total_value = TransactionsGrowthPresenter.all.value_at(date) - Contribution.where(date: date).value + Expense.where(date: date).value
    return 1 if total_value == 0

    Ownership.total_at(date) / total_value
  end
end<commit_msg>Fixed major bug with transfer logic<commit_after>class Ownership < ActiveRecord::Base
  belongs_to :user

  def self.total_at(date)
    where('date <= ?', date).sum(:units)
  end

  def self.new_unit_per_amount_multiplier_at(date)
    # Assume all contributions and expenses are incurred at once on the same day
    total_value = TransactionsGrowthPresenter.all.value_at(date) - Contribution.where(date: date).value + Expense.where(date: date).value
    return 1 if total_value == 0

    # Assume all unit movement are incurred at once on the same day
    Ownership.total_at(date - 1) / total_value
  end
end
{'fraction_non_alphanumeric': 0.08912655971479501, 'fraction_numerical': 0.004456327985739751, 'mean_word_length': 4.297169811320755, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2190248', 'n_tokens_mistral': 362, 'n_tokens_neox': 346, 'n_words': 97}