06/03 Optimize codes, Schwab account
This commit is contained in:
@@ -329,8 +329,10 @@ def get_portfolio_summary():
|
||||
Also returns per-account groups for investments that are linked to an account
|
||||
(e.g. separate Schwab Individual vs Roth IRA views).
|
||||
"""
|
||||
from sqlalchemy import func
|
||||
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_name,
|
||||
).all()
|
||||
|
||||
Reference in New Issue
Block a user