06/03 Optimize codes, Schwab account

This commit is contained in:
2026-06-03 14:50:36 -04:00
parent 302fbf5fe2
commit 4834cb1c73
+3 -1
View File
@@ -329,8 +329,10 @@ def get_portfolio_summary():
Also returns per-account groups for investments that are linked to an account Also returns per-account groups for investments that are linked to an account
(e.g. separate Schwab Individual vs Roth IRA views). (e.g. separate Schwab Individual vs Roth IRA views).
""" """
from sqlalchemy import func
investments = Investment.query.filter_by(is_active=True).order_by( investments = Investment.query.filter_by(is_active=True).order_by(
Investment.account_id.asc().nullslast(), func.isnull(Investment.account_id), # 0 for linked, 1 for NULL → linked first
Investment.account_id,
Investment.asset_type, Investment.asset_type,
Investment.asset_name, Investment.asset_name,
).all() ).all()