DashboardAnalyticsController::calculateNetWorthAt ran one balance query per account, and was called once per compared period, so the net-worth endpoint issued ~2*N balance queries. It also re-fetched the account list on every call. Fetch the accounts once and build a single BalanceLookup::forAccounts() over the compared date range (the same batch loader already used by the balance evolution endpoints), then read each balance from memory. Carry-forward semantics match the previous 'latest balance on or before the date' query, so results are unchanged; a query-count regression test locks the balance queries to a fixed number regardless of account count. |
||
|---|---|---|
| .. | ||
| Controllers | ||
| Middleware | ||
| Requests | ||
| Responses | ||