mirror of
https://github.com/we-promise/sure.git
synced 2026-05-06 20:34:06 +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"
|
auto_kind = "funds_movement"
|
||||||
elsif detected_label == "Contribution"
|
elsif detected_label == "Contribution"
|
||||||
auto_kind = "investment_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
|
end
|
||||||
|
|
||||||
# Set investment activity label, kind, and category if detected
|
# Set investment activity label, kind, and category if detected
|
||||||
|
|||||||
@@ -79,6 +79,12 @@ class Family < ApplicationRecord
|
|||||||
@income_statement ||= IncomeStatement.new(self)
|
@income_statement ||= IncomeStatement.new(self)
|
||||||
end
|
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
|
def investment_statement
|
||||||
@investment_statement ||= InvestmentStatement.new(self)
|
@investment_statement ||= InvestmentStatement.new(self)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Transfer::Creator
|
|||||||
end
|
end
|
||||||
|
|
||||||
def investment_contributions_category
|
def investment_contributions_category
|
||||||
source_account.family.categories.find_by(name: Category.investment_contributions_name)
|
source_account.family.investment_contributions_category
|
||||||
end
|
end
|
||||||
|
|
||||||
def inflow_transaction
|
def inflow_transaction
|
||||||
|
|||||||
Reference in New Issue
Block a user