mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
Improve HoldingCalculator Security Preloading
- Include securities from both trades and current holdings - Ensure unique securities are preloaded - Enhance logging for preloaded securities
This commit is contained in:
parent
9c846e7de4
commit
bdec61f312
1 changed files with 4 additions and 0 deletions
|
@ -117,7 +117,11 @@ class Account::HoldingCalculator
|
|||
end
|
||||
|
||||
def preload_securities
|
||||
# Get securities from trades and current holdings
|
||||
securities = trades.map(&:entryable).map(&:security).uniq
|
||||
securities += account.holdings.where(date: Date.current).map(&:security)
|
||||
securities.uniq!
|
||||
|
||||
Rails.logger.info "[HoldingCalculator] Preloading #{securities.size} securities for account #{account.id}"
|
||||
|
||||
securities.each do |security|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue