1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-09 15:35:22 +02:00

Handle holding quantity generation for reverse syncs correctly when not all holdings are generated for current day (#2417)

* Handle reverse calculator starting portfolio generation correctly

* Fix current_holdings to handle different dates and hide zero quantities

- Use DISTINCT ON to get most recent holding per security instead of assuming same date
- Filter out zero quantity holdings from UI display
- Maintain cash display regardless of zero balance
- Use single efficient query with proper Rails syntax

* Continue to process holdings even if one is not resolvable

* Lint fixes
This commit is contained in:
Zach Gollwitzer 2025-06-26 16:57:17 -04:00 committed by GitHub
parent e60b5df442
commit 8db95623cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 281 additions and 39 deletions

View file

@ -52,7 +52,8 @@ class Holding::Materializer
def calculator
if strategy == :reverse
Holding::ReverseCalculator.new(account)
portfolio_snapshot = Holding::PortfolioSnapshot.new(account)
Holding::ReverseCalculator.new(account, portfolio_snapshot: portfolio_snapshot)
else
Holding::ForwardCalculator.new(account)
end