mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 14:31:25 +00:00
Centralize investment_contributions_category logic and update references for streamlined handling.
This commit is contained in:
@@ -155,7 +155,7 @@ class Account::ProviderImportAdapter
|
||||
auto_kind = "funds_movement"
|
||||
elsif detected_label == "Contribution"
|
||||
auto_kind = "investment_contribution"
|
||||
auto_category = account.family.categories.find_by(name: Category.investment_contributions_name)
|
||||
auto_category = account.family.investment_contributions_category
|
||||
end
|
||||
|
||||
# Set investment activity label, kind, and category if detected
|
||||
|
||||
@@ -79,6 +79,12 @@ class Family < ApplicationRecord
|
||||
@income_statement ||= IncomeStatement.new(self)
|
||||
end
|
||||
|
||||
# Returns the Investment Contributions category for this family, or nil if not found.
|
||||
# This is a bootstrapped category used for auto-categorizing transfers to investment accounts.
|
||||
def investment_contributions_category
|
||||
categories.find_by(name: Category.investment_contributions_name)
|
||||
end
|
||||
|
||||
def investment_statement
|
||||
@investment_statement ||= InvestmentStatement.new(self)
|
||||
end
|
||||
|
||||
@@ -43,7 +43,7 @@ class Transfer::Creator
|
||||
end
|
||||
|
||||
def investment_contributions_category
|
||||
source_account.family.categories.find_by(name: Category.investment_contributions_name)
|
||||
source_account.family.investment_contributions_category
|
||||
end
|
||||
|
||||
def inflow_transaction
|
||||
|
||||
Reference in New Issue
Block a user